Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
7f7b4cddb4
@ -42,7 +42,7 @@ if (!$res) die("Include of main fails");
|
||||
global $lang, $user, $conf;
|
||||
|
||||
|
||||
dol_include_once('/dolistore/class/dolistore.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
|
||||
$dolistore = new Dolistore();
|
||||
|
||||
$id_product = GETPOST('id_product', 'int');
|
||||
|
||||
@ -19,9 +19,145 @@
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class DolistoreModel
|
||||
*/
|
||||
class DolistoreModel
|
||||
{
|
||||
|
||||
function get_categories($parent = 0)
|
||||
{
|
||||
if (!isset($this->categories)) die('not possible');
|
||||
if ($parent != 0) {
|
||||
$html = '<ul>';
|
||||
} else {
|
||||
$html = '';
|
||||
}
|
||||
|
||||
$nbofcateg = count($this->categories);
|
||||
for ($i = 0; $i < $nbofcateg; $i++)
|
||||
{
|
||||
$cat = $this->categories[$i];
|
||||
if ($cat->is_root_category == 1 && $parent == 0) {
|
||||
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
|
||||
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
|
||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
|
||||
$select = ($cat->id == $this->categorie) ? ' selected' : '';
|
||||
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
|
||||
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
|
||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($html == '<ul>') {
|
||||
return '';
|
||||
}
|
||||
if ($parent != 0) {
|
||||
return $html.'</ul>';
|
||||
} else {
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
function get_products()
|
||||
{
|
||||
global $langs, $conf;
|
||||
$html = "";
|
||||
$parity = "pair";
|
||||
$last_month = time() - (30 * 24 * 60 * 60);
|
||||
foreach ($this->products as $product) {
|
||||
$parity = ($parity == "impair") ? 'pair' : 'impair';
|
||||
|
||||
// check new product ?
|
||||
$newapp = '';
|
||||
if ($last_month < strtotime($product->date_add)) {
|
||||
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
|
||||
}
|
||||
|
||||
// check updated ?
|
||||
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
|
||||
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
|
||||
}
|
||||
|
||||
// add image or default ?
|
||||
if ($product->id_default_image != '') {
|
||||
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
|
||||
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
||||
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||
} else {
|
||||
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
|
||||
}
|
||||
|
||||
// free or pay ?
|
||||
if ($product->price > 0) {
|
||||
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
|
||||
2).'" /></a>';
|
||||
} else {
|
||||
$price = $langs->trans('Free');
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
|
||||
2).'" /></a>';
|
||||
}
|
||||
|
||||
//checking versions
|
||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||
//compatible
|
||||
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = '';
|
||||
} else {
|
||||
//never compatible, module expired
|
||||
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
} else {
|
||||
//need update
|
||||
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
|
||||
//output template
|
||||
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
||||
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
||||
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
|
||||
.'<br/><small>'.$version.'</small></h2>
|
||||
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
||||
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
||||
<td class="margeCote" align="right">'.$price.'</td>
|
||||
<td class="margeCote">'.$download_link.'</td>
|
||||
</tr>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function get_previous_link($text = '<<')
|
||||
{
|
||||
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
|
||||
}
|
||||
|
||||
function get_next_link($text = '>>')
|
||||
{
|
||||
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class Dolistore
|
||||
*/
|
||||
class Dolistore extends DolistoreModel
|
||||
{
|
||||
// params
|
||||
@ -182,135 +318,3 @@ class Dolistore extends DolistoreModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class DolistoreModel
|
||||
*/
|
||||
class DolistoreModel
|
||||
{
|
||||
|
||||
function get_categories($parent = 0)
|
||||
{
|
||||
if (!isset($this->categories)) die('not possible');
|
||||
if ($parent != 0) {
|
||||
$html = '<ul>';
|
||||
} else {
|
||||
$html = '';
|
||||
}
|
||||
|
||||
$nbofcateg = count($this->categories);
|
||||
for ($i = 0; $i < $nbofcateg; $i++)
|
||||
{
|
||||
$cat = $this->categories[$i];
|
||||
if ($cat->is_root_category == 1 && $parent == 0) {
|
||||
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
|
||||
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
|
||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
|
||||
$select = ($cat->id == $this->categorie) ? ' selected' : '';
|
||||
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
|
||||
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
|
||||
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($html == '<ul>') {
|
||||
return '';
|
||||
}
|
||||
if ($parent != 0) {
|
||||
return $html.'</ul>';
|
||||
} else {
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
function get_products()
|
||||
{
|
||||
global $langs, $conf;
|
||||
$html = "";
|
||||
$parity = "pair";
|
||||
$last_month = time() - (30 * 24 * 60 * 60);
|
||||
foreach ($this->products as $product) {
|
||||
$parity = ($parity == "impair") ? 'pair' : 'impair';
|
||||
|
||||
// check new product ?
|
||||
$newapp = '';
|
||||
if ($last_month < strtotime($product->date_add)) {
|
||||
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
|
||||
}
|
||||
|
||||
// check updated ?
|
||||
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
|
||||
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
|
||||
}
|
||||
|
||||
// add image or default ?
|
||||
if ($product->id_default_image != '') {
|
||||
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
|
||||
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
||||
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||
} else {
|
||||
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
|
||||
}
|
||||
|
||||
// free or pay ?
|
||||
if ($product->price > 0) {
|
||||
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
|
||||
2).'" /></a>';
|
||||
} else {
|
||||
$price = $langs->trans('Free');
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
|
||||
2).'" /></a>';
|
||||
}
|
||||
|
||||
//checking versions
|
||||
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
|
||||
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
|
||||
//compatible
|
||||
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = '';
|
||||
} else {
|
||||
//never compatible, module expired
|
||||
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
} else {
|
||||
//need update
|
||||
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
|
||||
$product->dolibarr_min, $product->dolibarr_max).'</span>';
|
||||
$compatible = 'NotCompatible';
|
||||
}
|
||||
|
||||
//output template
|
||||
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
||||
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
||||
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
|
||||
.'<br/><small>'.$version.'</small></h2>
|
||||
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
||||
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
||||
<td class="margeCote" align="right">'.$price.'</td>
|
||||
<td class="margeCote">'.$download_link.'</td>
|
||||
</tr>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function get_previous_link($text = '<<')
|
||||
{
|
||||
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
|
||||
}
|
||||
|
||||
function get_next_link($text = '>>')
|
||||
{
|
||||
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
// Here we define constants /!\ You need to replace this parameters
|
||||
//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/
|
||||
define('DEBUG', true); // Debug mode
|
||||
define('PS_SHOP_PATH', 'http://vmdevwww.dolistore.com/'); // Root path of your PrestaShop store
|
||||
define('PS_SHOP_PATH', 'https://www.dolistore.com/'); // Root path of your PrestaShop store
|
||||
define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office)
|
||||
require_once('./PSWebServiceLibrary.php');
|
||||
// Here we make the WebService Call
|
||||
|
||||
@ -260,10 +260,6 @@ p.titre {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.resultats_dhtml {
|
||||
width: 400px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* --------------------- Combo lists ------------------- */
|
||||
.select_design {
|
||||
|
||||
@ -51,26 +51,14 @@ function file(fichier) {
|
||||
}
|
||||
|
||||
|
||||
// Affichage des donnees aTexte dans le bloc identifie par aId
|
||||
function afficheDonnees(aId, aTexte) {
|
||||
|
||||
document.getElementById(aId).innerHTML = aTexte;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
|
||||
function verifResultat(aCible, aCode, iLimit) {
|
||||
if (aCode != '' && aCode.length >= iLimit) {
|
||||
|
||||
if (texte = file('facturation_dhtml.php?code='+escape(aCode))) {
|
||||
|
||||
afficheDonnees (aCible, texte);
|
||||
|
||||
document.getElementById(aCible).innerHTML = texte;
|
||||
} else
|
||||
|
||||
afficheDonnees (aCible, '');
|
||||
|
||||
document.getElementById(aCible).innerHTML = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -42,11 +42,10 @@ $langs->load("cashdesk");
|
||||
<tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
|
||||
<tr>
|
||||
<!-- Affichage de la reference et de la designation -->
|
||||
<!-- Suppression de l'attribut onkeyup qui causait un probleme d'emulation avec les douchettes -->
|
||||
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
|
||||
onchange="javascript: setSource('REF');"
|
||||
onkeyup="javascript: verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
|
||||
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
|
||||
onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
|
||||
onfocus="javascript: this.select();" />
|
||||
</td>
|
||||
<td class="select_design maxwidthonsmartphone">
|
||||
<?php /*
|
||||
|
||||
@ -30,8 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
*/
|
||||
class PaymentVarious extends CommonObject
|
||||
{
|
||||
//public $element='payment_various'; //!< Id that identify managed objects
|
||||
//public $table_element='payment_various'; //!< Name of table without prefix where object is stored
|
||||
public $element='variouspayment'; //!< Id that identify managed objects
|
||||
public $table_element='payment_various'; //!< Name of table without prefix where object is stored
|
||||
public $picto = 'bill';
|
||||
|
||||
var $tms;
|
||||
var $datep;
|
||||
@ -42,6 +43,7 @@ class PaymentVarious extends CommonObject
|
||||
var $num_payment;
|
||||
var $label;
|
||||
var $accountancy_code;
|
||||
var $fk_project;
|
||||
var $fk_bank;
|
||||
var $fk_user_author;
|
||||
var $fk_user_modif;
|
||||
@ -96,6 +98,7 @@ class PaymentVarious extends CommonObject
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
|
||||
$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
|
||||
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
||||
$sql.= " fk_user_modif=".$this->fk_user_modif;
|
||||
@ -154,6 +157,7 @@ class PaymentVarious extends CommonObject
|
||||
$sql.= " v.label,";
|
||||
$sql.= " v.note,";
|
||||
$sql.= " v.accountancy_code,";
|
||||
$sql.= " v.fk_projet as fk_project,";
|
||||
$sql.= " v.fk_bank,";
|
||||
$sql.= " v.fk_user_author,";
|
||||
$sql.= " v.fk_user_modif,";
|
||||
@ -185,6 +189,7 @@ class PaymentVarious extends CommonObject
|
||||
$this->label = $obj->label;
|
||||
$this->note = $obj->note;
|
||||
$this->accountancy_code = $obj->accountancy_code;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->fk_bank = $obj->fk_bank;
|
||||
$this->fk_user_author = $obj->fk_user_author;
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
@ -317,6 +322,7 @@ class PaymentVarious extends CommonObject
|
||||
if ($this->note) $sql.= ", note";
|
||||
$sql.= ", label";
|
||||
$sql.= ", accountancy_code";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", datec";
|
||||
$sql.= ", fk_bank";
|
||||
@ -451,6 +457,63 @@ class PaymentVarious extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->statut,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
* @param int $statut Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function LibStatut($statut,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statuts_short[$statut]);
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send name clicable (with possibly the picto)
|
||||
*
|
||||
|
||||
@ -29,6 +29,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
|
||||
|
||||
@ -44,6 +49,7 @@ $sens=GETPOST("sens","int");
|
||||
$amount=GETPOST("amount");
|
||||
$paymenttype=GETPOST("paymenttype");
|
||||
$accountancy_code=GETPOST("accountancy_code","int");
|
||||
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
@ -67,6 +73,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Link to a project
|
||||
if ($action == 'classin' && $user->rights->banque->modifier)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
}
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if ($action != 'addlink')
|
||||
@ -98,6 +111,7 @@ if (empty($reshook))
|
||||
$object->fk_user_author=$user->id;
|
||||
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
|
||||
$object->sens=GETPOST('sens');
|
||||
$object->fk_project= GETPOST('fk_project');
|
||||
|
||||
if (empty($datep) || empty($datev))
|
||||
{
|
||||
@ -205,6 +219,7 @@ llxHeader("",$langs->trans("VariousPayment"));
|
||||
|
||||
$form = new Form($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
|
||||
if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db);
|
||||
|
||||
if ($id)
|
||||
{
|
||||
@ -306,6 +321,21 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
// Associated project
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
|
||||
$numproject=$formproject->select_projects(-1, $projectid,'fk_project',0,0,1,1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -333,19 +363,52 @@ if ($action == 'create')
|
||||
|
||||
if ($id)
|
||||
{
|
||||
|
||||
$head=various_payment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), 0, 'payment');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment');
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.=$langs->trans('Project') . ' ';
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
|
||||
@ -404,6 +467,11 @@ if ($id)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ if ($result)
|
||||
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($obj->accountancy_journal);
|
||||
$accountstatic->accountancy_journal = $accountingjournal->code;
|
||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
|
||||
}
|
||||
|
||||
$accountstatic->label=$obj->blabel;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Dourseanud <rdoursenaud@gpcsolutions.fr>
|
||||
@ -197,7 +197,7 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Groups"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Groups", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder);
|
||||
if ($modecompta == 'BOOKKEEPING')
|
||||
{
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"],'amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -217,7 +218,7 @@ class FormCompany
|
||||
$out='';
|
||||
|
||||
// On recherche les departements/cantons/province active d'une region et pays actif
|
||||
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code FROM";
|
||||
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
|
||||
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
|
||||
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
|
||||
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
|
||||
@ -265,7 +266,15 @@ class FormCompany
|
||||
$out.= '<option value="'.$obj->rowid.'">';
|
||||
}
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$out.= $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
|
||||
if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE) && $conf->global->MAIN_SHOW_REGION_IN_STATE == 2) {
|
||||
$out.= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
|
||||
}
|
||||
else if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE) && $conf->global->MAIN_SHOW_REGION_IN_STATE == 1) {
|
||||
$out.= $obj->region_name . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
|
||||
}
|
||||
else {
|
||||
$out.= $obj->code . ' - ' . ($langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):($obj->name!='-'?$obj->name:''));
|
||||
}
|
||||
$out.= '</option>';
|
||||
}
|
||||
$i++;
|
||||
|
||||
@ -70,24 +70,24 @@ CREATE TABLE IF NOT EXISTS llx_expensereport_ik (
|
||||
datec datetime DEFAULT NULL,
|
||||
tms timestamp,
|
||||
fk_c_exp_tax_cat integer DEFAULT 0 NOT NULL,
|
||||
fk_range integer DEFAULT 0 NOT NULL,
|
||||
coef double DEFAULT 0 NOT NULL,
|
||||
offset double DEFAULT 0 NOT NULL
|
||||
fk_range integer DEFAULT 0 NOT NULL,
|
||||
coef double DEFAULT 0 NOT NULL,
|
||||
offset double DEFAULT 0 NOT NULL
|
||||
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
label varchar(48) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
active integer DEFAULT 1 NOT NULL
|
||||
active integer DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS llx_c_exp_tax_range (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_c_exp_tax_cat integer DEFAULT 1 NOT NULL,
|
||||
range_ik double DEFAULT 0 NOT NULL,
|
||||
range_ik double DEFAULT 0 NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
active integer DEFAULT 1 NOT NULL
|
||||
active integer DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO llx_c_type_fees (code, label, active, accountancy_code) VALUES
|
||||
@ -207,6 +207,8 @@ ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
||||
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
|
||||
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
|
||||
|
||||
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
|
||||
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_KO' where name = 'PAYPAL_MESSAGE_KO';
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_CREDITOR' where name = 'PAYPAL_CREDITOR';
|
||||
@ -234,5 +236,3 @@ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS
|
||||
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_sell VARCHAR(32) COLLATE utf8_unicode_ci;
|
||||
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) CHARACTER SET utf8;
|
||||
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_product MODIFY accountancy_code_buy VARCHAR(32) COLLATE utf8_unicode_ci;
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ create table llx_payment_various
|
||||
fk_typepayment integer NOT NULL,
|
||||
num_payment varchar(50), -- ref
|
||||
label varchar(255),
|
||||
accountancy_code varchar(32),
|
||||
accountancy_code varchar(32),
|
||||
fk_projet integer DEFAULT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
note text,
|
||||
fk_bank integer,
|
||||
|
||||
@ -156,4 +156,5 @@ DocumentModelBan=Template to print a page with BAN information.
|
||||
NewVariousPayment=New miscellaneous payments
|
||||
VariousPayment=Miscellaneous payments
|
||||
VariousPayments=Miscellaneous payments
|
||||
ShowVariousPayment=Show miscellaneous payments
|
||||
ShowVariousPayment=Show miscellaneous payments
|
||||
AddVariousPayment=Add miscellaneous payments
|
||||
@ -88,6 +88,7 @@ ListShippingAssociatedProject=List of shippings associated with the project
|
||||
ListFichinterAssociatedProject=List of interventions associated with the project
|
||||
ListExpenseReportsAssociatedProject=List of expense reports associated with the project
|
||||
ListDonationsAssociatedProject=List of donations associated with the project
|
||||
ListVariousPaymentsAssociatedProject=List of various payments associated with the project
|
||||
ListActionsAssociatedProject=List of events associated with the project
|
||||
ListTaskTimeUserProject=List of time consumed on tasks of project
|
||||
ActivityOnProjectToday=Activity on project today
|
||||
|
||||
@ -51,6 +51,7 @@ if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/d
|
||||
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||
if (! empty($conf->tax->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
|
||||
$langs->load("projects");
|
||||
$langs->load("companies");
|
||||
@ -439,6 +440,19 @@ $listofreferent=array(
|
||||
'datefieldname'=>'datem',
|
||||
'disableamount'=>0,
|
||||
'test'=>($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))),
|
||||
'variouspayment'=>array(
|
||||
'name'=>"VariousPayments",
|
||||
'title'=>"ListVariousPaymentsAssociatedProject",
|
||||
'class'=>'PaymentVarious',
|
||||
'table'=>'payment_various',
|
||||
'datefieldname'=>'datev',
|
||||
'margin'=>'minus',
|
||||
'disableamount'=>0,
|
||||
'urlnew'=>DOL_URL_ROOT.'/compta/bank_various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid,
|
||||
'lang'=>'banks',
|
||||
'buttonnew'=>'AddVariousPayment',
|
||||
'testnew'=>$user->rights->banque->modifier,
|
||||
'test'=>$conf->banque->enabled && $user->rights->banque->lire),
|
||||
/* No need for this, available on dedicated tab "Agenda/Events"
|
||||
'agenda'=>array(
|
||||
'name'=>"Agenda",
|
||||
@ -769,6 +783,7 @@ foreach ($listofreferent as $key => $value)
|
||||
// Thirdparty or user
|
||||
print '<td>';
|
||||
if (in_array($tablename, array('projet_task')) && $key == 'project_task') print ''; // if $key == 'project_task', we don't want details per user
|
||||
elseif (in_array($tablename, array('payment_various'))) print ''; // if $key == 'payment_various', we don't have any thirdparty
|
||||
elseif (in_array($tablename, array('expensereport_det','don','projet_task','stock_mouvement'))) print $langs->trans("User");
|
||||
else print $langs->trans("ThirdParty");
|
||||
print '</td>';
|
||||
@ -898,7 +913,8 @@ foreach ($listofreferent as $key => $value)
|
||||
$date=''; $total_time_by_line = null;
|
||||
if ($tablename == 'expensereport_det') $date = $element->date; // No draft status on lines
|
||||
elseif ($tablename == 'stock_mouvement') $date = $element->datem;
|
||||
if ($tablename == 'chargesociales') $date = $element->date_ech;
|
||||
elseif ($tablename == 'payment_various') $date = $element->datev;
|
||||
elseif ($tablename == 'chargesociales') $date = $element->date_ech;
|
||||
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
|
||||
{
|
||||
if ($tablename == 'don') $date = $element->datedon;
|
||||
@ -909,7 +925,7 @@ foreach ($listofreferent as $key => $value)
|
||||
elseif ($tablename == 'supplier_proposal') $date=$element->date_validation; // There is no other date for this
|
||||
elseif ($tablename == 'fichinter') $date=$element->datev; // There is no other date for this
|
||||
elseif ($tablename == 'projet_task') $date=''; // We show no date. Showing date of beginning of task make user think it is date of time consumed
|
||||
else
|
||||
else
|
||||
{
|
||||
$date=$element->date; // invoice, ...
|
||||
if (empty($date)) $date=$element->date_contrat;
|
||||
@ -963,7 +979,7 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$total_ht_by_line=null;
|
||||
$othermessage='';
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various') $total_ht_by_line=$element->amount;
|
||||
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
|
||||
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
||||
elseif (in_array($tablename, array('projet_task')))
|
||||
@ -1004,7 +1020,7 @@ foreach ($listofreferent as $key => $value)
|
||||
if (empty($value['disableamount']))
|
||||
{
|
||||
$total_ttc_by_line=null;
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various') $total_ttc_by_line=$element->amount;
|
||||
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
|
||||
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
|
||||
elseif ($tablename == 'projet_task')
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Josep Lluis Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -63,6 +64,7 @@ $search_account_supplier_code=trim(GETPOST('search_account_supplier_code'));
|
||||
$search_town=trim(GETPOST("search_town"));
|
||||
$search_zip=trim(GETPOST("search_zip"));
|
||||
$search_state=trim(GETPOST("search_state"));
|
||||
$search_region=trim(GETPOST("search_region"));
|
||||
$search_email=trim(GETPOST('search_email'));
|
||||
$search_phone=trim(GETPOST('search_phone'));
|
||||
$search_url=trim(GETPOST('search_url'));
|
||||
@ -168,6 +170,7 @@ $arrayfields=array(
|
||||
's.town'=>array('label'=>"Town", 'checked'=>1),
|
||||
's.zip'=>array('label'=>"Zip", 'checked'=>1),
|
||||
'state.nom'=>array('label'=>"State", 'checked'=>0),
|
||||
'region.nom'=>array('label'=>"Region", 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
|
||||
's.email'=>array('label'=>"Email", 'checked'=>0),
|
||||
's.url'=>array('label'=>"Url", 'checked'=>0),
|
||||
@ -387,7 +390,8 @@ $sql.= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape
|
||||
$sql.= " s.tms as date_update, s.datec as date_creation,";
|
||||
$sql.= " s.code_compta,s.code_compta_fournisseur,";
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= " region.code_region as region_code, region.nom as region_name";
|
||||
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
// We'll need these fields in order to filter by categ
|
||||
@ -404,6 +408,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
@ -436,6 +441,7 @@ if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fourniss
|
||||
if ($search_town) $sql.= natural_search("s.town",$search_town);
|
||||
if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip);
|
||||
if ($search_state) $sql.= natural_search("state.nom",$search_state);
|
||||
if ($search_region) $sql.= natural_search("region.nom",$search_region);
|
||||
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_email) $sql.= natural_search("s.email",$search_email);
|
||||
if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone);
|
||||
@ -728,6 +734,13 @@ if (! empty($arrayfields['state.nom']['checked']))
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Region
|
||||
if (! empty($arrayfields['region.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
@ -937,6 +950,7 @@ if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_f
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder);
|
||||
@ -1068,6 +1082,12 @@ while ($i < min($num, $limit))
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Region
|
||||
if (! empty($arrayfields['region.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->region_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
|
||||
@ -169,7 +169,7 @@ if ($action == 'addsite')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if (! $error && empty(GETPOST('WEBSITE_REF','alpha')))
|
||||
if (! $error && ! GETPOST('WEBSITE_REF','alpha'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user