Merge remote-tracking branch 'refs/remotes/Dolibarr/3.9' into 3.9

This commit is contained in:
fappels 2016-04-25 16:29:19 +02:00
commit bd002656cd
102 changed files with 1218 additions and 889 deletions

104
ChangeLog
View File

@ -12,6 +12,71 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade. 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.* ***** ***** ChangeLog for 3.9.0 compared to 3.8.* *****
For users: For users:
NEW: A new and more modern look for "eldy" theme. 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. - 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 ***** ***** 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: #3734 Do not show empty links of deleted source objects in stock movement list
FIX: #3890 Expected transactions bank account page, shows negative numbers 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. - 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 ***** ***** 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: #3734 Do not show empty links of deleted source objects in stock movement list
FIX: #4081 Added missing translation 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. - 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 ***** ***** ChangeLog for 3.5.7 compared to 3.5.6 *****
Fix: Paypal link were broken due to SSL v3 closed. Fix: Paypal link were broken due to SSL v3 closed.
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers 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 #810 ] Cannot update ODT template path
- Fix: [ bug #816 ] Sales journal does not reflect localtaxes - Fix: [ bug #816 ] Sales journal does not reflect localtaxes
- Fix: [ bug #817 ] Purchases 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 #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 #855 ] Holiday approval email in French
- Fix: [ bug #856 ] (Holidays module) Mail error if destination user doesn't have an email - 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: [ bug #736 ] Missing column in llx_c_chargesociales
- Fix: Localtax2 for Spain must be based into buyer - Fix: Localtax2 for Spain must be based into buyer
- Fix: [ bug #762 ] Bad profit calculation in Reporting - 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.* ***** ***** ChangeLog for 3.3 compared to 3.2.* *****
For users: For users:
@ -1952,7 +2050,7 @@ New experimental module:
For developers: For developers:
- New: Add webservice for thirdparty creation and list. - New: Add webservice for thirdparty creation and list.
- New: A module can overwrite templates parts. - 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: Uniformize code.
- New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and - New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and
WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER. WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER.

View File

@ -216,7 +216,7 @@ foreach ($search_array_options as $key => $val)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $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))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
@ -324,7 +324,22 @@ if ($resql)
{ {
foreach($extrafields->attribute_label as $key => $val) 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

View File

@ -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[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[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[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[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[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"; $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[22]= "code,label";
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label"; $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[26]= "code,label,short_label";
$tabfield[27]= "code,libelle"; $tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,affect,delay,newByMonth,country_id,country"; $tabfield[28]= "code,label,affect,delay,newByMonth,country_id,country";
@ -264,7 +264,7 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label"; $tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label"; $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[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle"; $tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,affect,delay,newByMonth,country"; $tabfieldvalue[28]= "code,label,affect,delay,newByMonth,country";
@ -296,7 +296,7 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label"; $tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label"; $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[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle"; $tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,affect,delay,newByMonth,fk_country"; $tabfieldinsert[28]= "code,label,affect,delay,newByMonth,fk_country";

View File

@ -62,7 +62,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
{ {
$producttmp->fetch(GETPOST('productid')); $producttmp->fetch(GETPOST('productid'));
$forbarcode=$producttmp->barcode; $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; if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;

View File

@ -59,7 +59,7 @@ exit;*/
print '<div class="inline-block" style="vertical-align: top">'; print '<div class="inline-block" style="vertical-align: top">';
print '<div class="principal">'; print '<div class="principal">';
$page=GETPOST('menu','alpha'); $page=GETPOST('menutpl','alpha');
if (empty($page)) $page='facturation'; if (empty($page)) $page='facturation';
if (in_array( if (in_array(

View File

@ -42,7 +42,7 @@ $langs->load("cashdesk");
*/ */
//header("Content-type: text/html; charset=UTF-8"); //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(); $arrayofjs=array();
$arrayofcss=array('/cashdesk/css/style.css'); $arrayofcss=array('/cashdesk/css/style.css');

View File

@ -99,31 +99,24 @@ class Facturation
$product = new Product($db); $product = new Product($db);
$product->fetch($this->id); $product->fetch($this->id);
$sql = "SELECT taux";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva";
$sql.= " WHERE rowid = ".$this->tva();
dol_syslog("ajoutArticle", LOG_DEBUG); $vatrowid = $this->tva();
$resql = $db->query($sql);
if ($resql) $tmp = getTaxesFromId($vatrowid);
{ $vat_rate = $tmp['rate'];
$obj = $db->fetch_object($resql); $vat_npr = $tmp['npr'];
$vat_rate=$obj->taux;
//var_dump($vat_rate);exit; $localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
}
else
{
dol_print_error($db);
}
// Define part of HT, VAT, TTC // 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 // Calcul du total ht sans remise
$total_ht = $resultarray[0]; $total_ht = $resultarray[0];
$total_vat = $resultarray[1]; $total_vat = $resultarray[1];
$total_ttc = $resultarray[2]; $total_ttc = $resultarray[2];
$total_localtax1 = $resultarray[9];
$total_localtax2 = $resultarray[10];
// Calcul du montant de la remise // Calcul du montant de la remise
if ($this->remisePercent()) if ($this->remisePercent())
@ -160,6 +153,9 @@ class Facturation
$newcartarray[$i]['remise']=price2num($montant_remise_ht); $newcartarray[$i]['remise']=price2num($montant_remise_ht);
$newcartarray[$i]['total_ht']=price2num($total_ht,'MT'); $newcartarray[$i]['total_ht']=price2num($total_ht,'MT');
$newcartarray[$i]['total_ttc']=price2num($total_ttc,'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; $_SESSION['poscart']=$newcartarray;
$this->raz(); $this->raz();
@ -213,11 +209,17 @@ class Facturation
// Total HT // Total HT
$remise = $tab[$i]['remise']; $remise = $tab[$i]['remise'];
$total_ht += ($tab[$i]['total_ht']); $total_ht += ($tab[$i]['total_ht']);
$total_vat += ($tab[$i]['total_vat']);
$total_ttc += ($tab[$i]['total_ttc']); $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_ttc = $total_ttc;
$this->prix_total_ht = $total_ht; $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; $this->montant_tva = $total_ttc - $total_ht;
//print $this->prix_total_ttc.'eeee'; exit; //print $this->prix_total_ttc.'eeee'; exit;
@ -442,9 +444,8 @@ class Facturation
* @param int $aTva Vat * @param int $aTva Vat
* @return int Vat * @return int Vat
*/ */
public function tva ( $aTva=null ) public function tva($aTva=null)
{ {
if ( !$aTva ) { if ( !$aTva ) {
return $this->tva; return $this->tva;
@ -467,9 +468,8 @@ class Facturation
* @param string $aNumFacture Invoice ref * @param string $aNumFacture Invoice ref
* @return string Invoice ref * @return string Invoice ref
*/ */
public function numInvoice( $aNumFacture=null ) public function numInvoice($aNumFacture=null)
{ {
if ( !$aNumFacture ) { if ( !$aNumFacture ) {
return $this->num_facture; return $this->num_facture;

View File

@ -37,7 +37,7 @@ switch ( $_GET['action'] )
default: default:
if ( $_POST['hdnSource'] != 'NULL' ) 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"; if (! empty($conf->stock->enabled) && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $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; 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; $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
/** add Ditto for MultiPrix*/
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$productid = $ret['rowid']; $productid = $ret['rowid'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$product = new Product($db); $product = new Product($db);
$product->fetch($productid); $product->fetch($productid);
$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))
{
if(isset($product->multiprices[$societe->price_level])) if(isset($product->multiprices[$societe->price_level]))
{ {
$ret['price'] = $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[$societe->price_level];
// $product->multiprices_min_ttc[$societe->price_level]; // $product->multiprices_min_ttc[$societe->price_level];
// $product->multiprices_base_type[$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->id($ret['rowid']);
$obj_facturation->ref($ret['ref']); $obj_facturation->ref($ret['ref']);
$obj_facturation->stock($ret['reel']); $obj_facturation->stock($ret['reel']);
$obj_facturation->prix($ret['price']); $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 // Definition du filtre pour n'afficher que le produit concerne
if ( $_POST['hdnSource'] == 'LISTE' ) if ( $_POST['hdnSource'] == 'LISTE' )
@ -107,7 +134,7 @@ switch ( $_GET['action'] )
$filtre = $_POST['txtRef']; $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 else
{ {
@ -115,11 +142,11 @@ switch ( $_GET['action'] )
if ( $_POST['hdnSource'] == 'REF' ) 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 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 else
{ {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
} }
break; break;
case 'ajout_article': // We have clicked on button "Add product" 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 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->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->remisePercent($_POST['txtRemise']);
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart'] $obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
// We update prixTotalTtc // We update prixTotalTtc
} }
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break; break;
case 'suppr_article': case 'suppr_article':
$obj_facturation->supprArticle($_GET['suppr_id']); $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; break;
} }
// We saved object obj_facturation // We saved object obj_facturation
$_SESSION['serObjFacturation'] = serialize($obj_facturation); $_SESSION['serObjFacturation'] = serialize($obj_facturation);
//var_dump($_SESSION['serObjFacturation']);
header('Location: '.$redirection); header('Location: '.$redirection);
exit; exit;

View File

@ -125,7 +125,7 @@ if ( $retour >= 0 )
$_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : ''); $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : '');
//var_dump($_SESSION);exit; //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; exit;
} }
else else

View File

@ -119,7 +119,7 @@ $langs->load("cashdesk");
<td></td> <td></td>
<!-- Choix de la remise --> <!-- Choix de la remise -->
<td><input class="texte1" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/> <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> </td>
<!-- Affichage du total HT --> <!-- Affichage du total HT -->
<td><input class="texte1_off" type="text" name="txtTotal" value="" disabled /></td><td></td> <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); ?> <?php //var_dump($tab_tva); ?>
<select name="selTva" onchange="javascript: modif();" > <select name="selTva" onchange="javascript: modif();" >
<?php <?php
$tva_tx = $obj_facturation->tva(); $tva_tx = $obj_facturation->tva(); // Try to get a previously entered VAT rowid. First time, this will return empty.
$tab_tva_size=count($tab_tva);
for($i=0;$i < $tab_tva_size;$i++) {
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'; $selected = 'selected';
else 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> </select>

View File

@ -62,7 +62,7 @@ $langs->load("main");
print '<div class="menu_bloc">'; print '<div class="menu_bloc">';
print '<ul class="menu">'; print '<ul class="menu">';
// Link to new sell // 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) // 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>'; print '<li class="menu_choix2"><a href=".." target="backoffice"><span>'.$langs->trans("BackOffice").'</span></a></li>';
// Disconnect // Disconnect

View File

@ -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> <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> <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> </div>
</form> </form>

View File

@ -42,7 +42,7 @@ switch ($action)
default: default:
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=validation'; $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
break; break;
@ -85,13 +85,13 @@ switch ($action)
$obj_facturation->paiementLe($txtDatePaiement); $obj_facturation->paiementLe($txtDatePaiement);
} }
$redirection = 'affIndex.php?menu=validation'; $redirection = 'affIndex.php?menutpl=validation';
break; break;
case 'retour': case 'retour':
$redirection = 'affIndex.php?menu=facturation'; $redirection = 'affIndex.php?menutpl=facturation';
break; break;
@ -158,45 +158,30 @@ switch ($action)
// Get content of cart // Get content of cart
$tab_liste = $_SESSION['poscart']; $tab_liste = $_SESSION['poscart'];
// Loop on each product // Loop on each line into cart
$tab_liste_size=count($tab_liste); $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 $tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
$product = new Product($db); $vat_rate = $tmp['rate'];
$product->fetch($tab_liste[$i]['fk_article']); $vat_npr = $tmp['npr'];
$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;
$invoiceline=new FactureLigne($db); $invoiceline=new FactureLigne($db);
$invoiceline->fk_product=$tab_liste[$i]['fk_article']; $invoiceline->fk_product=$tab_liste[$i]['fk_article'];
$invoiceline->desc=$tab_article['label']; $invoiceline->desc=$tab_liste[$i]['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->qty=$tab_liste[$i]['qte']; $invoiceline->qty=$tab_liste[$i]['qte'];
$invoiceline->remise_percent=$tab_liste[$i]['remise_percent']; $invoiceline->remise_percent=$tab_liste[$i]['remise_percent'];
$invoiceline->price=$tab_article['price']; $invoiceline->price=$tab_liste[$i]['price'];
$invoiceline->subprice=$tab_article['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_ht=$tab_liste[$i]['total_ht'];
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc']; $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; $invoice->lines[]=$invoiceline;
} }
@ -336,7 +321,7 @@ switch ($action)
if (! $error) if (! $error)
{ {
$db->commit(); $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 else
{ {

View File

@ -1090,17 +1090,22 @@ if ($id > 0)
// Thirdparty - Contact // Thirdparty - Contact
if ($conf->societe->enabled) 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 '<td>';
print '<div class="maxwidth200onsmartphone">';
$events=array(); $events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); $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','',1,1,0,$events); print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0);
print '</td>'; print '</div>';
print '</td></tr>';
// Contact // 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'); $form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>'; print '</div>';
print '</td>';
print '</tr>';
} }
// Project // Project
@ -1108,10 +1113,10 @@ if ($id > 0)
{ {
$formproject=new FormProjets($db); $formproject=new FormProjets($db);
$langs->load("project"); $langs->load("projects");
print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); $numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
if ($numprojet==0) if ($numprojet==0)
{ {
print ' &nbsp; <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>'; print ' &nbsp; <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 // 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 '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
print '</td></tr>'; print '</td></tr>';
@ -1136,7 +1141,7 @@ if ($id > 0)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 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(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
@ -1281,7 +1286,7 @@ if ($id > 0)
// Third party - Contact // Third party - Contact
if ($conf->societe->enabled) 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 (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
{ {
if ($object->thirdparty->fetch($object->thirdparty->id)) if ($object->thirdparty->fetch($object->thirdparty->id))

View File

@ -759,9 +759,12 @@ if (empty($reshook))
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$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_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 (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
} }
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';

View File

@ -2780,6 +2780,8 @@ class Propal extends CommonObject
*/ */
function getLinesArray() 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 = '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.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,'; $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]->id = $obj->rowid; // for backward compatibility
$this->lines[$i]->rowid = $obj->rowid; $this->lines[$i]->rowid = $obj->rowid;
$this->lines[$i]->label = $obj->custom_label; $this->lines[$i]->label = $obj->custom_label;
$this->lines[$i]->desc = $obj->description;
$this->lines[$i]->description = $obj->description; $this->lines[$i]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->ref; $this->lines[$i]->ref = $obj->ref;
$this->lines[$i]->product_ref = $obj->ref;
$this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->entity = $obj->entity; // Product entity
$this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_label = $obj->product_label;
$this->lines[$i]->product_desc = $obj->product_desc; $this->lines[$i]->product_desc = $obj->product_desc;

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * 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-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -657,10 +657,11 @@ if (empty($reshook))
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$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 (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
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]; if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$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)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
@ -2399,6 +2400,11 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</div>'; print '</div>';
} }
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action != 'presend') if ($action != 'presend')
{ {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';

View File

@ -985,6 +985,7 @@ class Commande extends CommonOrder
$this->user_author_id = $user->id; $this->user_author_id = $user->id;
$this->user_valid = ''; $this->user_valid = '';
$this->date = dol_now(); $this->date = dol_now();
$this->date_commande = dol_now();
$this->date_creation = ''; $this->date_creation = '';
$this->date_validation = ''; $this->date_validation = '';
$this->ref_client = ''; $this->ref_client = '';
@ -1674,7 +1675,7 @@ class Commande extends CommonOrder
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
$sql.= ' WHERE l.fk_commande = '.$this->id; $sql.= ' WHERE l.fk_commande = '.$this->id;
if ($only_product) $sql .= ' AND p.fk_product_type = 0'; 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); dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1695,6 +1696,7 @@ class Commande extends CommonOrder
$line->commande_id = $objp->fk_commande; $line->commande_id = $objp->fk_commande;
$line->label = $objp->custom_label; $line->label = $objp->custom_label;
$line->desc = $objp->description; $line->desc = $objp->description;
$line->description = $objp->description; // Description line
$line->product_type = $objp->product_type; $line->product_type = $objp->product_type;
$line->qty = $objp->qty; $line->qty = $objp->qty;
$line->tva_tx = $objp->tva_tx; $line->tva_tx = $objp->tva_tx;
@ -3212,12 +3214,14 @@ class Commande extends CommonOrder
} }
/** /**
* Return an array of order lines * Create an array of order lines
* *
* @return array Lines of order * @return int >0 if OK, <0 if KO
*/ */
function getLinesArray() function getLinesArray()
{ {
return $this->fetch_lines();
/*
$lines = array(); $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, '; $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(); $this->error=$this->db->error();
return -1; return -1;
} }*/
} }
/** /**

View File

@ -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'); $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) 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'); $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.='&amp;req_nb='.urlencode(GETPOST("req_nb"));
if (GETPOST("thirdparty")) $param.='&amp;thirdparty='.urlencode(GETPOST("thirdparty"));
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
@ -91,7 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$companystatic=new Societe($db); $companystatic=new Societe($db);
$bankaccountstatic=new Account($db); $bankaccountstatic=new Account($db);
llxHeader(); llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -114,12 +116,10 @@ $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
if (GETPOST("req_nb")) if (GETPOST("req_nb"))
{ {
$sql.= " AND b.num_chq LIKE '%".$db->escape(GETPOST("req_nb"))."%'"; $sql.= " AND b.num_chq LIKE '%".$db->escape(GETPOST("req_nb"))."%'";
$param.='&amp;req_nb='.urlencode(GETPOST("req_nb"));
} }
if (GETPOST("thirdparty")) if (GETPOST("thirdparty"))
{ {
$sql.=" AND s.nom LIKE '%".$db->escape(GETPOST("thirdparty"))."%'"; $sql.=" AND s.nom LIKE '%".$db->escape(GETPOST("thirdparty"))."%'";
$param.='&amp;thirdparty='.urlencode(GETPOST("thirdparty"));
} }
if ($bid) if ($bid)
{ {
@ -214,7 +214,7 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">'; 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>';
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"><input type="text" class="flat" name="req_nb" value="'.GETPOST("req_nb").'" size="2"></td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';

View File

@ -1925,7 +1925,7 @@ if ($action == 'create')
$objectsrc->fetch_thirdparty(); $objectsrc->fetch_thirdparty();
$projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project); $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 : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
// only if socid not filled else it's allready done upper // only if socid not filled else it's allready done upper

View File

@ -1065,7 +1065,7 @@ class Facture extends CommonInvoice
$this->lines=array(); $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 = '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.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.rang, l.special_code,';
$sql.= ' l.date_start as date_start, l.date_end as date_end,'; $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.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= ' WHERE l.fk_facture = '.$this->id; $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); dol_syslog(get_class($this).'::fetch_lines', LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -1092,7 +1092,9 @@ class Facture extends CommonInvoice
$line->rowid = $objp->rowid; // deprecated $line->rowid = $objp->rowid; // deprecated
$line->label = $objp->custom_label; // deprecated $line->label = $objp->custom_label; // deprecated
$line->desc = $objp->description; // Description line $line->desc = $objp->description; // Description line
$line->description = $objp->description; // Description line
$line->product_type = $objp->product_type; // Type of 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->product_ref = $objp->product_ref; // Ref product
$line->libelle = $objp->product_label; // TODO deprecated $line->libelle = $objp->product_label; // TODO deprecated
$line->product_label = $objp->product_label; // Label product $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_start = $date_start;
$this->line->date_end = $date_end; $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_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_localtax1 = $total_localtax1;
$this->line->total_localtax2 = $total_localtax2; $this->line->total_localtax2 = $total_localtax2;
$this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $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() 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 = '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.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
$sql .= ' l.situation_percent, l.fk_prev_id,'; $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]->description = $obj->description;
$this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->fk_product = $obj->fk_product;
$this->lines[$i]->ref = $obj->product_ref; $this->lines[$i]->ref = $obj->product_ref;
$this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->product_ref = $obj->product_ref;
$this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_label = $obj->product_label;
$this->lines[$i]->product_desc = $obj->product_desc; $this->lines[$i]->product_desc = $obj->product_desc;
$this->lines[$i]->fk_product_type = $obj->fk_product_type; $this->lines[$i]->fk_product_type = $obj->fk_product_type;
$this->lines[$i]->product_type = $obj->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]->qty = $obj->qty;
$this->lines[$i]->subprice = $obj->subprice; $this->lines[$i]->subprice = $obj->subprice;
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except; $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_ht = $obj->total_ht;
$this->lines[$i]->total_tva = $obj->total_tva; $this->lines[$i]->total_tva = $obj->total_tva;
$this->lines[$i]->total_ttc = $obj->total_ttc; $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]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->situation_percent = $obj->situation_percent; $this->lines[$i]->situation_percent = $obj->situation_percent;
$this->lines[$i]->fk_prev_id = $obj->fk_prev_id; $this->lines[$i]->fk_prev_id = $obj->fk_prev_id;
@ -3511,7 +3520,7 @@ class Facture extends CommonInvoice
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }*/
} }
/** /**

View File

@ -5,6 +5,7 @@
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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 * 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 * 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) 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.nom as name";
$sql.= ", s.rowid as socid"; $sql.= ", s.rowid as socid";
$sql.= ", s.code_fournisseur"; $sql.= ", s.code_fournisseur";

View File

@ -168,9 +168,11 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2)
$parameters["start"] = $date_start; $parameters["start"] = $date_start;
$parameters["end"] = $date_end; $parameters["end"] = $date_end;
$parameters["direction"] = 'sell'; $parameters["direction"] = 'sell';
$parameters["type"] = 'localtax'.$local;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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)) 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'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = '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)) if (is_array($coll_list))
{ {
$var=true; $var=true;

View File

@ -170,9 +170,11 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
$parameters["mode"] = $modetax; $parameters["mode"] = $modetax;
$parameters["year"] = $y; $parameters["year"] = $y;
$parameters["month"] = $m; $parameters["month"] = $m;
$parameters["type"] = 'localtax'.$localTaxType;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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) { if (! is_array($coll_listbuy) && $coll_listbuy == -1) {
$langs->load("errors"); $langs->load("errors");

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * 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 * 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 * 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); $payment_static=new Paiement($db);
$paymentfourn_static=new PaiementFourn($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="year" value="'.$year.'">';
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">'; $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; $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 if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode"); $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; $nextyear=$year_start; $nextquarter=$q;
if ($nextquarter < 4) $nextquarter++; if ($nextquarter < 4) $nextquarter++;
else { $nextquarter=1; $nextyear++; } 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"); else $description.='<br>'.$langs->trans("DepositsAreIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService"); $productcust=$langs->trans("ProductOrService");
@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
$nextyear=$year_start; $nextquarter=$q; $nextyear=$year_start; $nextquarter=$q;
if ($nextquarter < 4) $nextquarter++; if ($nextquarter < 4) $nextquarter++;
else { $nextquarter=1; $nextyear++; } 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"); 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; $description.=$fsearch;
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService"); $productcust=$langs->trans("ProductOrService");
@ -203,16 +191,13 @@ if($local==1){
// VAT Received and paid // VAT Received and paid
$y = $year_current; $y = $year_current;
$total = 0; $total = 0;
$i=0; $i=0;
// Load arrays of datas // 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_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');
$x_paye = local_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy', $local);
echo '<table class="noborder" width="100%">'; echo '<table class="noborder" width="100%">';
@ -230,14 +215,14 @@ if (! is_array($x_coll) || ! is_array($x_paye))
else else
{ {
$x_both = array(); $x_both = array();
//now, from these two arrays, get another array with one rate per line //now, from these two arrays, get another array with one rate per line
foreach(array_keys($x_coll) as $my_coll_rate) 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']['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']['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']['links'] = '';
$x_both[$my_coll_rate]['coll']['detail'] = array(); $x_both[$my_coll_rate]['coll']['detail'] = array();
foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy) 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 //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_sum = 0;
$x_coll_ht = 0; $x_coll_ht = 0;
$x_paye_sum = 0; $x_paye_sum = 0;
@ -314,8 +296,6 @@ else
$span=3; $span=3;
if ($modetax == 0) $span+=2; if ($modetax == 0) $span+=2;
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
if($conf->global->$calc ==0 || $conf->global->$calc == 2){ if($conf->global->$calc ==0 || $conf->global->$calc == 2){
// Customers invoices // Customers invoices
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -345,8 +325,6 @@ else
if($rate!=0){ if($rate!=0){
print "<tr>"; 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 '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
@ -400,9 +378,7 @@ else
print price($fields['totalht']); print price($fields['totalht']);
if (price2num($fields['ftotal_ttc'])) if (price2num($fields['ftotal_ttc']))
{ {
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
//print ' ('.round($ratiolineinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';
} }
@ -413,7 +389,6 @@ else
{ {
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
print '<td class="nowrap" align="right">'; print '<td class="nowrap" align="right">';
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
if ($fields['payment_amount'] && $fields['ftotal_ttc']) if ($fields['payment_amount'] && $fields['ftotal_ttc'])
{ {
$payment_static->id=$fields['payment_id']; $payment_static->id=$fields['payment_id'];
@ -424,7 +399,7 @@ else
print $langs->trans("NotUsedForGoods"); print $langs->trans("NotUsedForGoods");
} }
else { else {
print $fields['payment_amount']; print price($fields['payment_amount']);
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';
@ -491,7 +466,6 @@ else
if($conf->global->$calc ==0 || $conf->global->$calc == 1){ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
echo '<table class="noborder" width="100%">'; echo '<table class="noborder" width="100%">';
//print table headers for this quadri - expenses now //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 '<tr class="liste_titre">';
print '<td align="left">'.$elementsup.'</td>'; print '<td align="left">'.$elementsup.'</td>';
print '<td align="left">'.$productsup.'</td>'; print '<td align="left">'.$productsup.'</td>';
@ -585,7 +559,7 @@ else
} }
else else
{ {
print $fields['payment_amount']; print price($fields['payment_amount']);
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net> * 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 * 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 * 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); $num = $db->num_rows($result);
$i = 0; $i = 0;
$urladd = "&amp;id=".$prev_id; $urladd = "&amp;id=".$id;
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";

View File

@ -897,7 +897,7 @@ $parameters["date_end"] = $date_end;
$parameters["bc"] = $bc; $parameters["bc"] = $bc;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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; print $hookmanager->resPrint;
if ($mysoc->tva_assuj != 'franchise') // Assujeti if ($mysoc->tva_assuj != 'franchise') // Assujeti

View File

@ -472,7 +472,7 @@ $object = array(&$encaiss, &$encaiss_ttc, &$decaiss, &$decaiss_ttc);
$parameters["mode"] = $modecompta; $parameters["mode"] = $modecompta;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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 * Salaries

View File

@ -71,7 +71,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
$tva->datev=$datev; $tva->datev=$datev;
$tva->datep=$datep; $tva->datep=$datep;
$amount = GETPOST("amount"); $amount = price2num(GETPOST("amount"));
if ($refund == 1) { if ($refund == 1) {
$amount= -$amount; $amount= -$amount;
} }

View File

@ -250,9 +250,11 @@ $parameters["mode"] = $modetax;
$parameters["start"] = $date_start; $parameters["start"] = $date_start;
$parameters["end"] = $date_end; $parameters["end"] = $date_end;
$parameters["direction"] = 'sell'; $parameters["direction"] = 'sell';
$parameters["type"] = 'vat';
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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)) { if (is_array($coll_list)) {
$var=true; $var=true;
@ -333,7 +335,7 @@ $company_static=new Societe($db);
$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy'); $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$parameters["direction"] = '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)) { if (is_array($coll_list)) {
$var=true; $var=true;
$total = 0; $totalamount = 0; $total = 0; $totalamount = 0;

View File

@ -160,9 +160,10 @@ for ($m = 1 ; $m < 13 ; $m++ )
$parameters["mode"] = $modetax; $parameters["mode"] = $modetax;
$parameters["year"] = $y; $parameters["year"] = $y;
$parameters["month"] = $m; $parameters["month"] = $m;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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) if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{ {

View File

@ -325,10 +325,12 @@ else
$parameters["mode"] = $modetax; $parameters["mode"] = $modetax;
$parameters["start"] = $date_start; $parameters["start"] = $date_start;
$parameters["end"] = $date_end; $parameters["end"] = $date_end;
$parameters["type"] = 'vat';
$object = array(&$x_coll, &$x_paye, &$x_both); $object = array(&$x_coll, &$x_paye, &$x_both);
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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) foreach(array_keys($x_coll) as $rate)
{ {

View File

@ -378,10 +378,12 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$parameters["mode"] = $modetax; $parameters["mode"] = $modetax;
$parameters["start"] = $date_start; $parameters["start"] = $date_start;
$parameters["end"] = $date_end; $parameters["end"] = $date_end;
$parameters["type"] = 'vat';
$object = array(&$x_coll, &$x_paye, &$x_both); $object = array(&$x_coll, &$x_paye, &$x_both);
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance')); $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) { foreach (array_keys($x_coll) as $rate) {
$subtot_coll_total_ht = 0; $subtot_coll_total_ht = 0;

View File

@ -127,7 +127,7 @@ $fieldstosearchall = array(
// Definition of fields for list // Definition of fields for list
$arrayfields=array( $arrayfields=array(
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), '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.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), 'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'p.zip'=>array('label'=>$langs->trans("Zip"), '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.= " 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"; $sql.= " co.code as country_code";
// Add fields from extrafields // 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 // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $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); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $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))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);

View File

@ -8,7 +8,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * 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 * 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 * 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. // 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); $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); $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]; $total_ht = $tabprice[0];

View File

@ -1,5 +1,6 @@
<?php <?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 * 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 * it under the terms of the GNU General Public License as published by

View File

@ -34,6 +34,8 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
$res=@include '../../main.inc.php'; $res=@include '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
//global $hookmanager;
$hookmanager->initHooks(array('searchform'));
$search_boxvalue=GETPOST('q'); $search_boxvalue=GETPOST('q');
@ -120,9 +122,8 @@ if (! empty($conf->hrm->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_EMPLO
$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')); $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 // Execute hook addSearchEntry
$parameters=array(); $parameters=array('search_boxvalue'=>$search_boxvalue);
$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters); $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
if (empty($reshook)) if (empty($reshook))
{ {
@ -131,13 +132,6 @@ if (empty($reshook))
else $arrayresult=$hookmanager->resArray; else $arrayresult=$hookmanager->resArray;
print json_encode($arrayresult); print json_encode($arrayresult);
if (is_object($db)) $db->close(); if (is_object($db)) $db->close();

View File

@ -2890,7 +2890,7 @@ abstract class CommonObject
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null"); $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; $sql.= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG); dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);

View File

@ -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) * @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok * @return string|int <0 if ko, label if ok

View File

@ -3937,7 +3937,7 @@ class Form
/** /**
* Load into the cache vat rates of a country * 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 * @return int Nb of loaded lines, 0 if already loaded, <0 if KO
*/ */
function load_cache_vatrates($country_code) function load_cache_vatrates($country_code)
@ -4013,10 +4013,17 @@ class Form
$return=''; $return='';
// Define defaultnpr and defaultttx // Define defaultnpr, defaultttx and defaultcode
$defaultnpr=($info_bits & 0x01); $defaultnpr=($info_bits & 0x01);
$defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr); $defaultnpr=(preg_match('/\*/',$selectedrate) ? 1 : $defaultnpr);
$defaulttx=str_replace('*','',$selectedrate); $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 // Check parameters
if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code) if (is_object($societe_vendeuse) && ! $societe_vendeuse->country_code)
@ -4113,7 +4120,11 @@ class Form
$return.= $rate['nprtva'] ? '*': ''; $return.= $rate['nprtva'] ? '*': '';
if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')'; if ($addcode && $rate['code']) $return.=' ('.$rate['code'].')';
$return.= '"'; $return.= '"';
if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) if ($defaultcode)
{
if ($defaultcode == $rate['code']) $return.= ' selected';
}
elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
{ {
$return.= ' selected'; $return.= ' selected';
} }
@ -4838,7 +4849,10 @@ class Form
foreach($array as $key => $val) 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 unset($array[$key]); // We don't want this field
continue; continue;

View File

@ -136,7 +136,7 @@ class FormActions
if (empty($onlyselect)) 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 ' <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 else

View File

@ -859,11 +859,15 @@ class FormFile
{ {
$fileinfo = pathinfo($file['name']); $fileinfo = pathinfo($file['name']);
print '<td align="center">'; 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) if (image_format_supported($file['name']) > 0)
{ {
$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 '<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="">'; print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">';
print '</a>'; print '</a>';
} }
else print '&nbsp;'; else print '&nbsp;';

View File

@ -874,13 +874,13 @@ class FormMail extends Form
{ {
$ret=array(); $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.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'"; $sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
$sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND entity IN (".getEntity("c_email_templates").")";
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; $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 = '')"; 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; //print $sql;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -894,7 +894,7 @@ class FormMail extends Form
$line->id=$obj->rowid; $line->id=$obj->rowid;
$line->label=$obj->label; $line->label=$obj->label;
$line->topic=$obj->topic; $line->topic=$obj->topic;
$line->content=$obj->lacontentbel; $line->content=$obj->content;
$line->lang=$obj->lang; $line->lang=$obj->lang;
$this->lines_model[]=$line; $this->lines_model[]=$line;
} }

View File

@ -188,7 +188,7 @@ class FormProjets
continue; continue;
} }
$labeltoshow=dol_trunc($obj->ref,18).' - '.$obj->title; $labeltoshow=dol_trunc($obj->ref,18);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')';
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength); $labeltoshow.=' '.dol_trunc($obj->title,$maxlength);

View File

@ -1451,6 +1451,12 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask); $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); $resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
if (is_numeric($resupload) && $resupload > 0) 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) // Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example // 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) // Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example // 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'); setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');

View File

@ -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 * Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
* TODO * 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 * 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. * 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 int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param Societe $buyer Company object * @param Societe $buyer Company object
* @param Societe $seller 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, ...) * @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; global $db, $mysoc;
@ -3531,11 +3562,16 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller)
// Search local taxes // Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $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"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; 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."'"; else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
$sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; $sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'"; if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
}
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
@ -4559,7 +4595,7 @@ function setEventMessage($mesgs, $style='mesgs')
*/ */
function setEventMessages($mesg, $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); if (empty($mesgs)) setEventMessage($mesg, $style);
else else
{ {

View File

@ -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 string $extName Extension to differenciate thumb file name ('_small', '_mini')
* @param int $quality Quality of compression (0=worst, 100=best) * @param int $quality Quality of compression (0=worst, 100=best)
* @param string $outdir Directory where to store thumb * @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 * @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) 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 // Initialisation des variables selon l'extension de l'image
// $targetformat is 0 by default, in such case, we keep original extension
switch($targetformat) switch($targetformat)
{ {
case IMAGETYPE_GIF: // 1 case IMAGETYPE_GIF: // 1

View File

@ -40,8 +40,8 @@
* @param float $pu Unit price (HT or TTC selon price_base_type) * @param float $pu Unit price (HT or TTC selon price_base_type)
* @param float $remise_percent_ligne Discount for line * @param float $remise_percent_ligne Discount for line
* @param float $txtva 0=do not apply standard tax, Vat rate=apply * @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 $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) * @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 float $remise_percent_global 0
* @param string $price_base_type HT=Unit price parameter is HT, TTC=Unit price parameter is TTC * @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 * @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 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 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) * @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) * 1=total_vat, (main vat only)
* 2=total_ttc, (total_ht + main vat + local taxes) * 2=total_ttc, (total_ht + main vat + local taxes)
* 3=pu_ht, * 3=pu_ht,

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com> * 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 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * 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) * 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 * The function gets the VAT in split results, as the VAT declaration asks

View File

@ -1034,6 +1034,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$langs->load("withdrawals"); $langs->load("withdrawals");
$langs->load("banks"); $langs->load("banks");
$langs->load("bills"); $langs->load("bills");
$langs->load('categories');
// Bank-Caisse // Bank-Caisse
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))

View File

@ -227,7 +227,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* Return if a code is used (by other element) * Return if a code is used (by other element)
* *
* @param DoliDB $db Handler acces base * @param DoliDB $db Handler acces base
* @param string $code Code a verifier * @param string $code Code to check
* @param Product $product Objet product * @param Product $product Objet product
* @return int 0 if available, <0 if KO * @return int 0 if available, <0 if KO
*/ */
@ -277,10 +277,18 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
return ''; return '';
} }
dol_syslog(get_class($this).'::verif_syntax codefortest='.$codefortest." typefortest=".$typefortest);
$newcodefortest=$codefortest; $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 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); $result=check_value($mask,$newcodefortest);

View File

@ -911,7 +911,7 @@ class pdf_einstein extends ModelePDFCommandes
// VAT // VAT
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;

View File

@ -57,7 +57,6 @@ class pdf_proforma extends pdf_einstein
} }
/** /**
* Show top header of page. * Show top header of page.
* *

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * 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 * 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 * 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("main");
$langs->load("trips"); $langs->load("trips");
$langs->load("project"); $langs->load("project");
$langs->load("trips");
$this->db = $db; $this->db = $db;
$this->name = ""; $this->name = "";
@ -91,8 +91,8 @@ class pdf_standard extends ModeleExpenseReport
$this->option_condreg = 1; // Affiche conditions reglement $this->option_condreg = 1; // Affiche conditions reglement
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues $this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 1; // Affiche si il y a eu escompte $this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 1; // Support credit notes $this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text $this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts $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 // Define position of columns
$this->posxpiece=$this->marge_gauche+1; $this->posxpiece=$this->marge_gauche+1;
$this->posxdesc=20; $this->posxcomment=$this->marge_gauche+10;
$this->posxdate=85; $this->posxdate=80;
$this->posxtype=105; $this->posxtype=97;
$this->posxprojet=125; $this->posxprojet=116;
$this->posxtva=145; $this->posxtva=136;
$this->posxup=162; $this->posxup=148;
$this->posxqty=176; $this->posxqty=166;
$this->postotalttc=186; $this->postotalttc=178;
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxdate-=20; $this->posxdate-=20;
@ -127,7 +127,6 @@ class pdf_standard extends ModeleExpenseReport
$this->localtax1=array(); $this->localtax1=array();
$this->localtax2=array(); $this->localtax2=array();
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
} }
@ -199,7 +198,7 @@ class pdf_standard extends ModeleExpenseReport
// Create pdf instance // Create pdf instance
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $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 $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) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0); $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 $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 // New page
$pdf->AddPage(); $pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
@ -249,9 +239,9 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$tab_top = 95; $tab_top = 95;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?95:10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?65:10);
$tab_height = 110; $tab_height = 130;
$tab_height_newpage = 110; $tab_height_newpage = 150;
// Show notes // Show notes
$notetoshow=empty($object->note_public)?'':$object->note_public; $notetoshow=empty($object->note_public)?'':$object->note_public;
@ -297,7 +287,7 @@ class pdf_standard extends ModeleExpenseReport
$piece_comptable = $i +1; $piece_comptable = $i +1;
$curY = $nexY; $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->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage); $pdf->setTopMargin($tab_top_newpage);
@ -305,18 +295,17 @@ class pdf_standard extends ModeleExpenseReport
$pageposbefore=$pdf->getPage(); $pageposbefore=$pdf->getPage();
// Description of product line // Description of product line
$curX = $this->posxdesc-1; $curX = $this->posxcomment-1;
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
// Accountancy piece // Accountancy piece
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); $pdf->MultiCell($this->posxcomment-$this->posxpiece-0.8, 4, $piece_comptable, 0, 'C');
// Comments // Comments
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxcomment, $curY); $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
$nexY = $pdf->GetY(); $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. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// Date // Date
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxdate, $curY); $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 // Type
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtype, $curY); $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 // Project
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxprojet, $curY); $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 // VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY); $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 // Unit price
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxup, $curY); $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 // Quantity
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxqty, $curY); $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 // Total with all taxes
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->postotalttc-1, $curY); $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'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R');
$nexY+=5;
// Cherche nombre de lignes a venir pour savoir si place suffisante // Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line if ($i < ($nblignes - 1)) // If it's not last line
{ {
//on recupere la description du produit suivant //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) //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; $nblineFollowComment = 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;
}
} }
else // If it's last line 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 // Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) while ($pagenb < $pageposafter)
@ -591,6 +566,8 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetTextColor(111,81,124); $pdf->SetTextColor(111,81,124);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
if ($showaddress)
{
// Sender properties // Sender properties
$carac_emetteur = ''; $carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
@ -714,23 +691,30 @@ class pdf_standard extends ModeleExpenseReport
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L'); $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 PDF $pdf Object PDF
* @param int $tab_top Tab top * @param int $tab_top Tab top
* @param int $tab_height Tab height * @param int $tab_height Tab height
* @param int $nexY next y * @param int $nexY next y
* @param Translate $outputlangs Output langs * @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 * @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; global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
// Amount in (at tab_top - 1) // Amount in (at tab_top - 1)
@ -745,56 +729,86 @@ class pdf_standard extends ModeleExpenseReport
// Rect prend une longueur en 3eme param // 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); $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 // line prend une position y en 3eme param
if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
}
$pdf->SetFont('','',8); $pdf->SetFont('','',8);
// Accountancy piece // Accountancy piece
if (empty($hidetop))
{
$pdf->SetXY($this->posxpiece-1, $tab_top+1); $pdf->SetXY($this->posxpiece-1, $tab_top+1);
$pdf->MultiCell($this->posxdesc-$this->posxpiece-1,1,'','','R'); $pdf->MultiCell($this->posxcomment-$this->posxpiece-1,1,'','','R');
}
// Comments // Comments
$pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height); $pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdesc-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L'); {
$pdf->SetXY($this->posxcomment-1, $tab_top+1);
$pdf->MultiCell($this->posxdate-$this->posxcomment-1,1,$outputlangs->transnoentities("Description"),'','L');
}
// Date // Date
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height); $pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxdate-1, $tab_top+1); $pdf->SetXY($this->posxdate-1, $tab_top+1);
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C'); $pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
}
// Type // Type
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height); $pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxtype-1, $tab_top+1); $pdf->SetXY($this->posxtype-1, $tab_top+1);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C'); $pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C');
}
// Project // Project
$pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height); $pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxprojet-1, $tab_top+1); $pdf->SetXY($this->posxprojet-1, $tab_top+1);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C'); $pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
}
// VAT // VAT
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_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->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxtva-1, $tab_top+1); $pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); $pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
} }
}
// Unit price // Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C'); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
}
// Quantity // Quantity
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R'); $pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
}
// Total with all taxes // Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
if (empty($hidetop))
{
$pdf->SetXY($this->postotalttc-1, $tab_top+1); $pdf->SetXY($this->postotalttc-1, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
}
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }

View File

@ -1109,7 +1109,7 @@ class pdf_crabe extends ModelePDFFactures
// VAT // VAT
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;

View File

@ -178,10 +178,10 @@ class modCommande extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $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_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_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.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_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",'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_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 $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'; $keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; 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] =' 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] .=' 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] .=' '.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 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.'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'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_extrafields as extra ON c.rowid = extra.fk_object';

View File

@ -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_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill'; $this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export","other")); $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.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_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",'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_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 $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'; $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; 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] =' 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] .=' 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] .=' '.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 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.'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'; $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_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill'; $this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export")); $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.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_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",'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_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 $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'; $keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; 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] =' 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] .=' 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] .=' '.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 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.'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'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object';

View File

@ -138,15 +138,18 @@ class modFicheinter extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $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_label[$r]='InterventionCardsAndInterventionLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("ficheinter","export")); $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.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_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",'fd.rowid'=>"inter_line",'fd.date'=>"inter_line",'fd.duree'=>'inter_line','fd.description'=>'inter_line'); $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_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_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] =' FROM '.MAIN_DB_PREFIX.'fichinter as f';
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_fichinter'; $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).')'; $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('intervention',1).')';
$r++; $r++;

View File

@ -91,7 +91,7 @@ class modIncoterm extends DolibarrModules
'tablib'=>array("Incoterms"), // Label of tables 'tablib'=>array("Incoterms"), // Label of tables
'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields
'tabsqlsort'=>array("rowid ASC"), // Sort order '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) '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) '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') 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid')

View File

@ -171,10 +171,10 @@ class modPropale extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $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_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("propale","export")); $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.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_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",'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_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 $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'; $keyforselect='propal'; $keyforelement='propal'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; 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] =' 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] .=' 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] .=' '.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 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.'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'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object';

View File

@ -189,13 +189,13 @@ class modStock extends DolibarrModules
$this->import_icon[$r]=$this->picto; $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_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_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( $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_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') '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"
); );
} }

View File

@ -64,8 +64,12 @@ class printing_printgcp extends PrintingDriver
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $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=$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 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$this->db = $db; $this->db = $db;
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_id = $conf->global->OAUTH_GOOGLE_ID;
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET; $this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
// Token storage // Token storage
@ -107,10 +111,6 @@ class printing_printgcp extends PrintingDriver
$this->errors[] = $e->getMessage(); $this->errors[] = $e->getMessage();
} }
} }
if (!$conf->oauth->enabled) {
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'ModuleAuthNotActive', 'type'=>'info');
} else {
if ($this->google_id != '' && $this->google_secret != '') { if ($this->google_id != '' && $this->google_secret != '') {
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info'); $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'):'')); $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'):''));

View File

@ -1073,7 +1073,7 @@ class pdf_azur extends ModelePDFPropales
// VAT // VAT
foreach($this->tva as $tvakey => $tvaval) foreach($this->tva as $tvakey => $tvaval)
{ {
if ($tvakey > 0) // On affiche pas taux 0 if ($tvakey != 0) // On affiche pas taux 0
{ {
$this->atleastoneratenotnull++; $this->atleastoneratenotnull++;

View File

@ -145,6 +145,10 @@ class mod_syslog_sentry extends LogHandler implements LogHandlerInterface
*/ */
public function export($content) public function export($content)
{ {
if (! $this->isActive()) {
return;
}
global $conf; global $conf;
$dsn = $conf->global->SYSLOG_SENTRY_DSN; $dsn = $conf->global->SYSLOG_SENTRY_DSN;
$client = new Raven_Client( $client = new Raven_Client(

View File

@ -111,7 +111,7 @@ else
if (! empty($conf->user->enabled) && $user->rights->user->user->lire) if (! empty($conf->user->enabled) && $user->rights->user->user->lire)
{ {
$langs->load("users"); $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'));
} }
} }

View File

@ -193,11 +193,17 @@ else {
{ {
$parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int')); $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int'));
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
if (!empty($hookmanager->resPrint)) {
print $hookmanager->resPrint;
}
} }
if (is_object($hookmanager) && ! empty($senderissupplier)) if (is_object($hookmanager) && ! empty($senderissupplier))
{ {
$parameters=array('htmlname'=>'addproduct'); $parameters=array('htmlname'=>'addproduct');
$reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action); $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() { jQuery(document).ready(function() {
<?php <?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?> if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
$('#addline').click(function (e) {
return checkFreeLine(e, "np_marginRate");
});
$("input[name='np_marginRate']:first").blur(function(e) { $("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, "np_marginRate"); return checkFreeLine(e, "np_marginRate");
}); });
<?php <?php
} }
if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?> if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
$('#addline').click(function (e) {
return checkFreeLine(e, "np_markRate");
});
$("input[name='np_markRate']:first").blur(function(e) { $("input[name='np_markRate']:first").blur(function(e) {
return checkFreeLine(e, "np_markRate"); return checkFreeLine(e, "np_markRate");
}); });

View File

@ -252,6 +252,10 @@ if (! empty($conf->margin->enabled))
jQuery("input[name='np_marginRate']:first").val(''); jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']: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("#remise_percent").keyup(function() {
jQuery("input[name='np_marginRate']:first").val(''); jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']: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 */ /* Add rules to reset price_ht from margin info */
<?php <?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'. /* 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) { $("input[name='np_marginRate']:first").blur(function(e) {
return checkEditLine(e, "np_marginRate"); return checkEditLine(e, "np_marginRate");
});*/ });*/
<?php <?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'. /* 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) { $("input[name='np_markRate']:first").blur(function(e) {
return checkEditLine(e, "np_markRate"); return checkEditLine(e, "np_markRate");
@ -330,6 +328,7 @@ if (! empty($conf->margin->enabled))
/* If margin rate field empty, do nothing. */ /* 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 */ /* 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) function checkEditLine(e, npRate)
{ {
var buying_price = $("input[name='buying_price']:first"); var buying_price = $("input[name='buying_price']:first");

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); 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)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -9,6 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@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 * 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 * 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. // 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); $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); $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]; $total_ht = $tabprice[0];

View File

@ -680,7 +680,7 @@ class ProductFournisseur extends Product
{ {
global $langs; global $langs;
$langs->load("suppliers"); $langs->load("suppliers");
$out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").' &nbsp; (':'').($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").' &nbsp; (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':'');
return $out; return $out;
} }

View File

@ -243,7 +243,7 @@ if (! empty($conf->fournisseur->enabled))
/* /*
* List of users allowed * 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.= " FROM ".MAIN_DB_PREFIX."user as u,";
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= " ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as rd"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as rd";
@ -276,6 +276,7 @@ if ($resql)
$userstatic->id=$obj->rowid; $userstatic->id=$obj->rowid;
$userstatic->lastname=$obj->lastname; $userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname; $userstatic->firstname=$obj->firstname;
$userstatic->email=$obj->email;
print $userstatic->getNomUrl(1); print $userstatic->getNomUrl(1);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -2227,8 +2227,12 @@ else
// Delete // Delete
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer) if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
{ {
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.'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
} }
}
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@ -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="socid" value="'.$obj->socid.'">';
print '<input type="hidden" name="societe" value="'.$obj->name.'">'; print '<input type="hidden" name="societe" value="'.$obj->name.'">';
dol_fiche_head(''); dol_fiche_head(null);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -315,6 +315,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
$parameters=array('facid'=>$facid, 'ref'=>$ref, 'objcanvas'=>$objcanvas); $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 $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; $error=$hookmanager->error; $errors=$hookmanager->errors;
@ -434,7 +435,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$preselectedchoice=$addwarning?'no':'yes'; $preselectedchoice=$addwarning?'no':'yes';
print '<br>'; 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')) if (GETPOST('closepaidinvoices'))
{ {
$text.='<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); $text.='<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");

View File

@ -2217,7 +2217,7 @@ class soap_transport_http extends nusoap_base {
} }
$this->use_curl = $use_curl; $this->use_curl = $use_curl;
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); 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].')':''));
} }
/** /**

View File

@ -19,7 +19,7 @@
-- Structure de la table llx_establishment -- 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, rowid integer NOT NULL auto_increment PRIMARY KEY,
entity integer NOT NULL DEFAULT 1, entity integer NOT NULL DEFAULT 1,
name varchar(50), name varchar(50),

View File

@ -14,7 +14,7 @@
-- You should have received a copy of the GNU General Public License -- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- 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, rowid integer NOT NULL auto_increment PRIMARY KEY,
fk_product integer NOT NULL, fk_product integer NOT NULL,
file_name varchar(200) NOT NULL, file_name varchar(200) NOT NULL,

View File

@ -16,7 +16,7 @@
-- --
-- =================================================================== -- ===================================================================
CREATE TABLE IF NOT EXISTS llx_usergroup_extrafields ( CREATE TABLE llx_usergroup_extrafields (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp, tms timestamp,
fk_object integer NOT NULL, fk_object integer NOT NULL,

View File

@ -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> 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) FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature 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 ##### ##### OSCommerce 1 #####
OSCommerceErrorConnectOkButWrongDatabase=Connection succeeded but database doesn't look to be an OSCommerce database (Key %s not found in table %s). 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. OSCommerceTestOk=Connection to server '%s' on database '%s' with user '%s' successfull.

View File

@ -62,6 +62,9 @@ SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail
ShippingSentByEMail=Shipment %s sent by EMail ShippingSentByEMail=Shipment %s sent by EMail
ShippingValidated= Shipment %s validated ShippingValidated= Shipment %s validated
InterventionSentByEMail=Intervention %s sent by EMail InterventionSentByEMail=Intervention %s sent by EMail
ProposalDeleted=Proposal deleted
OrderDeleted=Order deleted
InvoiceDeleted=Invoice deleted
NewCompanyToDolibarr= Third party created NewCompanyToDolibarr= Third party created
DateActionPlannedStart= Planned start date DateActionPlannedStart= Planned start date
DateActionPlannedEnd= Planned end date DateActionPlannedEnd= Planned end date

View File

@ -195,3 +195,4 @@ WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when dis
WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. 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. 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. 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.

View File

@ -175,6 +175,7 @@ PredefinedProductsAndServicesToSell=Predefined products/services to sell
PredefinedProductsToPurchase=Predefined product to purchase PredefinedProductsToPurchase=Predefined product to purchase
PredefinedServicesToPurchase=Predefined services to purchase PredefinedServicesToPurchase=Predefined services to purchase
PredefinedProductsAndServicesToPurchase=Predefined products/services to puchase PredefinedProductsAndServicesToPurchase=Predefined products/services to puchase
NotPredefinedProducts=Not predefined products/services
GenerateThumb=Generate thumb GenerateThumb=Generate thumb
ProductCanvasAbility=Use special "canvas" addons ProductCanvasAbility=Use special "canvas" addons
ServiceNb=Service #%s ServiceNb=Service #%s

View File

@ -1948,7 +1948,7 @@ if (! function_exists("llxFooter"))
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n"; print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
print '<script type="text/javascript"> print '<script type="text/javascript">
jQuery(document).ready(function () { 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"; </script>' . "\n";
} }

View File

@ -109,7 +109,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta
$marge_tx_ret=''; $marge_tx_ret='';
$marque_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'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$product = new ProductFournisseur($db); $product = new ProductFournisseur($db);
if ($product->fetch_product_fournisseur_price($fk_pa)) if ($product->fetch_product_fournisseur_price($fk_pa))

View File

@ -165,16 +165,15 @@ print '</form>';
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"; $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.= " 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,"; 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(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','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(".$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.= " 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."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $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.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND d.fk_product = p.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
if ($id > 0) if ($id > 0)
@ -186,8 +185,8 @@ if (!empty($enddate))
$sql .= " AND d.buy_price_ht IS NOT NULL"; $sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql .= " AND d.buy_price_ht <> 0"; $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"; 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"; else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity";
$sql.=$db->order($sortfield,$sortorder); $sql.=$db->order($sortfield,$sortorder);
// TODO: calculate total to display then restore pagination // TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset); //$sql.= $db->plimit($conf->liste_limit +1, $offset);
@ -260,6 +259,8 @@ if ($result)
} }
else { else {
print '<td>'; print '<td>';
if ($objp->rowid > 0)
{
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
$product_static->id=$objp->rowid; $product_static->id=$objp->rowid;
$product_static->ref=$objp->ref; $product_static->ref=$objp->ref;
@ -267,6 +268,11 @@ if ($result)
$product_static->entity=$objp->pentity; $product_static->entity=$objp->pentity;
$text=$product_static->getNomUrl(1); $text=$product_static->getNomUrl(1);
print $text.= ' - '.$objp->label; print $text.= ' - '.$objp->label;
}
else
{
print $langs->trans("NotPredefinedProducts");
}
print "</td>\n"; print "</td>\n";
//print "<td>".$product_static->getNomUrl(1)."</td>\n"; //print "<td>".$product_static->getNomUrl(1)."</td>\n";
} }

View File

@ -48,6 +48,7 @@ $price_level = GETPOST('price_level', 'int');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$price_by_qty_rowid = GETPOST('pbq', 'int'); $price_by_qty_rowid = GETPOST('pbq', 'int');
$finished = GETPOST('finished', 'int');
/* /*
* View * View
@ -180,9 +181,9 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
$form = new Form($db); $form = new Form($db);
if (empty($mode) || $mode == 1) { 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) { } 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(); $db->close();

View File

@ -7,10 +7,10 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * 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-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) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro> * Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
* Copyright (C) 2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com> * Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* *
@ -2571,7 +2571,7 @@ class Product extends CommonObject
$sql = "SELECT rowid, fk_product"; $sql = "SELECT rowid, fk_product";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " WHERE fk_soc = ".$id_fourn; $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 fk_product != ".$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
@ -2593,7 +2593,7 @@ class Product extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " WHERE fk_soc = ".$id_fourn; $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)"; else $sql.= " AND (ref_fourn = '' OR ref_fourn IS NULL)";
$sql.= " AND quantity = '".$quantity."'"; $sql.= " AND quantity = '".$quantity."'";
$sql.= " AND fk_product = ".$this->id; $sql.= " AND fk_product = ".$this->id;
@ -2622,7 +2622,7 @@ class Product extends CommonObject
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", ".$this->id; $sql.= ", ".$this->id;
$sql.= ", ".$id_fourn; $sql.= ", ".$id_fourn;
$sql.= ", '".$ref_fourn."'"; $sql.= ", '".$this->db->escape($ref_fourn)."'";
$sql.= ", ".$quantity; $sql.= ", ".$quantity;
$sql.= ", ".$user->id; $sql.= ", ".$user->id;
$sql.= ", 0"; $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) * @param string $type Label type (long or short)
* @return string|int <0 if ko, label if ok * @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)); $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; continue;
} }

View File

@ -361,7 +361,7 @@ if ($id > 0 || ! empty($ref))
} }
print '</td>'; 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; $total+=$totalline;
print '<td align="right">'; print '<td align="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency)); print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency));

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com> * Copyright (C) 2013 Adolfo segura <adolfo.segura@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * 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 * 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 * 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 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array($contextpage)); $hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$form=new Form($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('product'); $extralabels = $extrafields->fetch_name_optionals_label('product');
@ -120,6 +122,15 @@ if (! empty($conf->barcode->enabled)) {
$fieldstosearchall['p.barcode']='Gencod'; $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 // Definition of fields for lists
$arrayfields=array( $arrayfields=array(
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), '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); $htmlother=new FormOther($db);
$form=new Form($db);
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
{ {
@ -210,7 +220,7 @@ else
//$sql.= ' pfp.ref_fourn as ref_supplier, '; //$sql.= ' pfp.ref_fourn as ref_supplier, ';
$sql.= ' MIN(pfp.unitprice) as minsellprice'; $sql.= ' MIN(pfp.unitprice) as minsellprice';
// Add fields from extrafields // 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 // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $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); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $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))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $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.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
$sql.= ' p.datec, p.tms'; $sql.= ' p.datec, p.tms';
// Add fields from extrafields // 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 // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook
@ -402,15 +412,6 @@ else
print '</div>'; 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 $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -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.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.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.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.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.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); 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);

View File

@ -508,7 +508,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS))
$file = $reg[1]; $file = $reg[1];
$classname = substr($file,4); $classname = substr($file,4);
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$file.'.php'; require_once $dir.$file.'.php';
$module = new $file; $module = new $file;

View File

@ -352,7 +352,7 @@ if (empty($reshook))
$result=$object->delete($user); $result=$object->delete($user);
if ($result > 0) if ($result > 0)
{ {
setEventMessagess($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: index.php"); header("Location: index.php");
exit; exit;
} }
@ -535,7 +535,7 @@ if ($action == 'create' && $user->rights->projet->creer)
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; 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)) if (! empty($backtopage))
{ {
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';

View File

@ -1146,14 +1146,21 @@ class Project extends CommonObject
//Generate next ref //Generate next ref
$defaultref=''; $defaultref='';
$obj = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON; $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)
{ {
$file=dol_buildpath($reldir."core/modules/project/".$obj.'.php',0);
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.'.php'; if (file_exists($file))
{
$filefound=1;
dol_include_once($reldir."core/modules/project/".$obj.'.php');
$modProject = new $obj; $modProject = new $obj;
$defaultref = $modProject->getNextValue(is_object($clone_project->thirdparty)?$clone_project->thirdparty->id:0,$clone_project); $defaultref = $modProject->getNextValue(is_object($clone_project->thirdparty)?$clone_project->thirdparty:null, $clone_project);
break;
}
} }
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
$clone_project->ref=$defaultref; $clone_project->ref=$defaultref;

View File

@ -348,8 +348,7 @@ $langs->load("orders");
$langs->load("proposals"); $langs->load("proposals");
$langs->load("margins"); $langs->load("margins");
//print load_fiche_titre($langs->trans("Profit"),'','title_accountancy'); print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy');
print '<div class="center">'.img_picto("", "title_accountancy").' '.$langs->trans("Profit").'</div><br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -106,7 +106,7 @@ $hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // 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_'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all" // 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 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $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."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"; $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 // 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_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) if ($search_user > 0)
{ {
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; $sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
} }
$sql.= " WHERE p.entity IN (".getEntity('project').')'; $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 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 // 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 ($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 (! $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; 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 // Add where from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
@ -481,7 +493,22 @@ if ($resql)
{ {
foreach($extrafields->attribute_label as $key => $val) 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

View File

@ -66,7 +66,7 @@ $hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // 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_'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Security check // Security check
@ -226,6 +226,7 @@ $sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid,";
$sql.= " ".MAIN_DB_PREFIX."projet_task as t"; $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) if ($search_project_user > 0)
{ {
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp"; $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_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_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; 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 // Add where from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
@ -483,7 +497,22 @@ if ($resql)
{ {
foreach($extrafields->attribute_label as $key => $val) 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

View File

@ -5,9 +5,6 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * 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 * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
@ -79,6 +76,7 @@ $langs->load("suppliers");
$langs->load("propal"); $langs->load("propal");
$langs->load("interventions"); $langs->load("interventions");
$langs->load("contracts"); $langs->load("contracts");
$langs->load("products");
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('consumptionthirdparty')); $hookmanager->initHooks(array('consumptionthirdparty'));

View File

@ -101,7 +101,7 @@ $hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // 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_'); $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
@ -172,7 +172,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
} }
/* /*
* Actions * Actions
*/ */
@ -200,6 +199,7 @@ if (empty($reshook))
// Do we click on purge search criteria ? // 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 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_categ='';
$search_sale=''; $search_sale='';
$search_barcode=""; $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 // We'll need these fields in order to filter by categ
if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_soc"; if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_soc";
// Add fields from extrafields // 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 // Add fields from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $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); $tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey]; $typ=$extrafields->attribute_type[$tmpkey];
$mode=0; $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))) if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{ {
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode); $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
@ -592,35 +592,35 @@ if ($resql)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; 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>'; print '</td>';
} }
// Barcode // Barcode
if (! empty($arrayfields['s.barcode']['checked'])) if (! empty($arrayfields['s.barcode']['checked']))
{ {
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
// Customer code // Customer code
if (! empty($arrayfields['s.code_client']['checked'])) if (! empty($arrayfields['s.code_client']['checked']))
{ {
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
// Supplier code // Supplier code
if (! empty($arrayfields['s.code_fournisseur']['checked'])) if (! empty($arrayfields['s.code_fournisseur']['checked']))
{ {
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
// Account Customer code // Account Customer code
if (! empty($arrayfields['s.code_compta']['checked'])) if (! empty($arrayfields['s.code_compta']['checked']))
{ {
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
// Account Supplier code // Account Supplier code
@ -634,14 +634,14 @@ if ($resql)
if (! empty($arrayfields['s.town']['checked'])) if (! empty($arrayfields['s.town']['checked']))
{ {
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
// Zip // Zip
if (! empty($arrayfields['s.zip']['checked'])) if (! empty($arrayfields['s.zip']['checked']))
{ {
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
// Country // Country
@ -662,42 +662,42 @@ if ($resql)
{ {
// IdProf1 // IdProf1
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
if (! empty($arrayfields['s.siret']['checked'])) if (! empty($arrayfields['s.siret']['checked']))
{ {
// IdProf2 // IdProf2
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
if (! empty($arrayfields['s.ape']['checked'])) if (! empty($arrayfields['s.ape']['checked']))
{ {
// IdProf3 // IdProf3
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
if (! empty($arrayfields['s.idprof4']['checked'])) if (! empty($arrayfields['s.idprof4']['checked']))
{ {
// IdProf4 // IdProf4
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
if (! empty($arrayfields['s.idprof5']['checked'])) if (! empty($arrayfields['s.idprof5']['checked']))
{ {
// IdProf5 // IdProf5
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
if (! empty($arrayfields['s.idprof6']['checked'])) if (! empty($arrayfields['s.idprof6']['checked']))
{ {
// IdProf6 // IdProf6
print '<td class="liste_titre">'; 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>'; print '</td>';
} }
@ -759,7 +759,18 @@ if ($resql)
{ {
if (! empty($arrayfields["ef.".$key]['checked'])) 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>'; print '</td>';
} }
} }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Patrick Raguin <patrick.raguin@auguria.net> * 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) 2011-2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -1211,7 +1211,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('AllocateCommercial','commercial_id').'</td>'; print '<td>'.fieldLabel('AllocateCommercial','commercial_id').'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; 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>'; print '</td></tr>';
} }
@ -1885,7 +1885,7 @@ else
'name' => 'soc_origin', 'name' => 'soc_origin',
'label' => $langs->trans('MergeOriginThirdparty'), 'label' => $langs->trans('MergeOriginThirdparty'),
'type' => 'other', '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')
) )
); );

View File

@ -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_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_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_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_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab;
if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink;
@ -2893,12 +2893,10 @@ table.valid {
border-radius: 4px; border-radius: 4px;
} }
#tiptip_content { #tiptip_content {
-moz-border-radius:0px; -moz-border-radius:0px;
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
border-radius: 0px; border-radius: 0px;
background-color: rgb(255,255,255); background-color: rgb(255,255,255);
/* background-color: rgb(255,255,255);
background-color: rgba(255,255,255,0.95);*/
line-height: 1.4em; line-height: 1.4em;
min-width: 200px; min-width: 200px;
} }

View File

@ -3,12 +3,12 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * 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) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * 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 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* *
@ -349,6 +349,8 @@ if (empty($reshook)) {
$object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : ''; $object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : '';
$object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : ''; $object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : '';
$object->color = GETPOST("color") != '' ? GETPOST("color") : '';
if (! empty($conf->multicompany->enabled)) if (! empty($conf->multicompany->enabled))
{ {
if (! empty($_POST["superadmin"])) if (! empty($_POST["superadmin"]))
@ -375,20 +377,6 @@ if (empty($reshook)) {
$error ++; $error ++;
} }
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 (GETPOST('deletephoto')) { if (GETPOST('deletephoto')) {
$object->photo = ''; $object->photo = '';
} }
@ -412,7 +400,7 @@ if (empty($reshook)) {
} }
if (!$error && isset($_POST['contactid'])) { if (!$error && isset($_POST['contactid'])) {
$contactid = GETPOST('contactid'); $contactid = GETPOST('contactid', 'int');
if ($contactid > 0) { if ($contactid > 0) {
$contact = new Contact($db); $contact = new Contact($db);
@ -420,7 +408,7 @@ if (empty($reshook)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql .= " SET fk_socpeople=".$db->escape($contactid); $sql .= " SET fk_socpeople=".$db->escape($contactid);
if ($contact->socid) { if (!empty($contact->socid)) {
$sql .= ", fk_soc=".$db->escape($contact->socid); $sql .= ", fk_soc=".$db->escape($contact->socid);
} }
$sql .= " WHERE rowid=".$object->id; $sql .= " WHERE rowid=".$object->id;
@ -429,7 +417,7 @@ if (empty($reshook)) {
$sql .= " SET fk_socpeople=NULL, fk_soc=NULL"; $sql .= " SET fk_socpeople=NULL, fk_soc=NULL";
$sql .= " WHERE rowid=".$object->id; $sql .= " WHERE rowid=".$object->id;
} }
dol_syslog("fiche::update", LOG_DEBUG); dol_syslog("usercard::update", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) { if (!$resql) {
$error ++; $error ++;
@ -482,36 +470,32 @@ if (empty($reshook)) {
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->transnoentitiesnoconv("ErrorFailedToCreateDir", $dir), $mesgs, 'errors'); setEventMessages($langs->transnoentitiesnoconv("WarningYourLoginWasModifiedPleaseLogin"), null, 'warnings');
} }
} else { } else {
$db->rollback(); $db->rollback();
} }
} }
} else { }
}
else
{
if ($caneditpassword) // Case we can edit only password if ($caneditpassword) // Case we can edit only password
{ {
dol_syslog("Not allowed to change fields, only password");
$object->fetch($id); $object->fetch($id);
$object->oldcopy = dol_clone($object);
$ret = $object->setPassword($user, $_POST["password"]);
if ($ret < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
}
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$ret=$object->setPassword($user,$_POST["password"]); $ret = $object->setPassword($user, GETPOST("password"));
if ($ret < 0) if ($ret < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
}
}
// Change password with a new generated one // Change password with a new generated one
if ((($action == 'confirm_password' && $confirm == 'yes') if ((($action == 'confirm_password' && $confirm == 'yes')
@ -537,7 +521,7 @@ if (empty($reshook)) {
} }
else else
{ {
setEventMessages($langs->trans("PasswordChangedTo", $newpassword), null, 'errors'); setEventMessages($langs->trans("PasswordChangedTo", $newpassword), null, 'warnings');
} }
} }
} }
@ -1065,7 +1049,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print "</tr>\n"; print "</tr>\n";
// Accountancy code // Accountancy code
if ($conf->salaries->enabled) if ($conf->accounting->enabled)
{ {
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>'; print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
print '<td>'; print '<td>';
@ -1402,7 +1386,7 @@ else
print "</tr>\n"; print "</tr>\n";
// Accountancy code // Accountancy code
if ($conf->salaries->enabled) if ($conf->accounting->enabled)
{ {
print '<tr><td>'.$langs->trans("AccountancyCode").'</td>'; print '<tr><td>'.$langs->trans("AccountancyCode").'</td>';
print '<td>'.$object->accountancy_code.'</td>'; print '<td>'.$object->accountancy_code.'</td>';
@ -1749,13 +1733,14 @@ else
dol_fiche_head($head, 'user', $title, 0, 'user'); 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 (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->societe->enabled)) $rowspan++;
if (! empty($conf->adherent->enabled)) $rowspan++; if (! empty($conf->adherent->enabled)) $rowspan++;
if (! empty($conf->skype->enabled)) $rowspan++; if (! empty($conf->skype->enabled)) $rowspan++;
if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3; if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) $rowspan = $rowspan+3;
if (! empty($conf->agenda->enabled)) $rowspan++; if (! empty($conf->agenda->enabled)) $rowspan++;
if (! empty($conf->accounting->enabled)) $rowspan++;
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';
@ -2173,7 +2158,7 @@ else
print "</tr>\n"; print "</tr>\n";
// Accountancy code // Accountancy code
if ($conf->salaries->enabled) if ($conf->accounting->enabled)
{ {
print "<tr>"; print "<tr>";
print '<td>'.$langs->trans("AccountancyCode").'</td>'; print '<td>'.$langs->trans("AccountancyCode").'</td>';

View File

@ -4,7 +4,7 @@
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * 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) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
@ -162,7 +162,7 @@ class User extends CommonObject
*/ */
function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1) function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1)
{ {
global $langs, $conf, $user; global $conf, $user;
// Clean parameters // Clean parameters
$login=trim($login); $login=trim($login);
@ -207,6 +207,9 @@ class User extends CommonObject
} }
else // The fetch was forced on an entity else // The fetch was forced on an 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.")"; $sql.= " WHERE u.entity IN (0, ".$conf->entity.")";
} }
@ -256,7 +259,7 @@ class User extends CommonObject
$this->country_id = $obj->country_id; $this->country_id = $obj->country_id;
$this->country_code = $obj->country_id?$obj->country_code:''; $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_id = $obj->state_id;
$this->state_code = $obj->state_code; $this->state_code = $obj->state_code;
@ -1272,7 +1275,7 @@ class User extends CommonObject
$nbrowsaffected+=$this->db->affected_rows($resql); $nbrowsaffected+=$this->db->affected_rows($resql);
// Update password // Update password
if ($this->pass) if (!empty($this->pass))
{ {
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
{ {

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