Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into mko186
This commit is contained in:
commit
89e14043a1
@ -180,11 +180,17 @@ case "$1" in
|
||||
|
||||
# Now run the drop user
|
||||
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then
|
||||
echo postrm Database login $dbuser removed
|
||||
echo postrm Database login $dbuser@localhost removed
|
||||
else
|
||||
error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'localhost';\""
|
||||
echo postrm $error
|
||||
fi
|
||||
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'%';\"" ; then
|
||||
echo postrm Database login $dbuser@% removed
|
||||
else
|
||||
error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'%';\""
|
||||
echo postrm $error
|
||||
fi
|
||||
|
||||
# Now run the drop commands
|
||||
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
|
||||
|
||||
435
htdocs/adherents/canvas/actions_adherentcard_common.class.php
Normal file
435
htdocs/adherents/canvas/actions_adherentcard_common.class.php
Normal file
@ -0,0 +1,435 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contact/canvas/actions_adherentcard_common.class.php
|
||||
* \ingroup thirdparty
|
||||
* \brief Fichier de la classe Adherent card controller (common)
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class ActionsAdherentCardCommon
|
||||
* \brief Classe permettant la gestion des adherents par defaut
|
||||
*/
|
||||
abstract class ActionsAdherentCardCommon
|
||||
{
|
||||
var $db;
|
||||
var $dirmodule;
|
||||
var $targetmodule;
|
||||
var $canvas;
|
||||
var $card;
|
||||
|
||||
//! Template container
|
||||
var $tpl = array();
|
||||
//! Object container
|
||||
var $object;
|
||||
//! Error string
|
||||
var $error;
|
||||
//! Error array
|
||||
var $errors=array();
|
||||
|
||||
|
||||
/**
|
||||
* Instantiation of DAO class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function getInstanceDao()
|
||||
{
|
||||
if (! is_object($this->object))
|
||||
{
|
||||
$modelclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/dao_'.$this->targetmodule.'_'.$this->canvas.'.class.php');
|
||||
if (file_exists($modelclassfile))
|
||||
{
|
||||
// Include dataservice class (model)
|
||||
$ret = require_once $modelclassfile;
|
||||
if ($ret)
|
||||
{
|
||||
// Instantiate dataservice class (model)
|
||||
$modelclassname = 'Dao'.ucfirst($this->targetmodule).ucfirst($this->canvas);
|
||||
$this->object = new $modelclassname($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object
|
||||
*
|
||||
* @param int $id Object id
|
||||
* @return object Object loaded
|
||||
*/
|
||||
function getObject($id)
|
||||
{
|
||||
$ret = $this->getInstanceDao();
|
||||
|
||||
if (is_object($this->object) && method_exists($this->object,'fetch'))
|
||||
{
|
||||
if (! empty($id)) $this->object->fetch($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object = new Adherent($this->db);
|
||||
if (! empty($id)) $object->fetch($id);
|
||||
$this->object = $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data control
|
||||
*
|
||||
* @param string &$action Type of action
|
||||
* @param int $id Id of object
|
||||
* @return void
|
||||
*/
|
||||
function doActions(&$action, $id)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
// Creation utilisateur depuis Adherent
|
||||
if ($action == 'confirm_create_user' && GETPOST("confirm") == 'yes')
|
||||
{
|
||||
// Recuperation adherent actuel
|
||||
$result = $this->object->fetch($id);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Creation user
|
||||
$nuser = new User($this->db);
|
||||
$result=$nuser->create_from_member($this->object,$_POST["login"]);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$result2=$nuser->setPassword($user,$_POST["password"],0,1,1);
|
||||
if ($result2)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors=$nuser->error;
|
||||
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors=$this->object->errors;
|
||||
}
|
||||
}
|
||||
|
||||
// Creation adherent
|
||||
if ($action == 'add')
|
||||
{
|
||||
$this->assign_post();
|
||||
|
||||
if (! $_POST["name"])
|
||||
{
|
||||
array_push($this->errors,$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")));
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if ($_POST["name"])
|
||||
{
|
||||
$id = $this->object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors=$this->object->errors;
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||
{
|
||||
$result=$this->object->fetch($id);
|
||||
|
||||
$this->object->old_name = $_POST["old_name"];
|
||||
$this->object->old_firstname = $_POST["old_firstname"];
|
||||
|
||||
$result = $this->object->delete();
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: list.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors=$this->object->errors;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
if ($_POST["cancel"])
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$this->object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($_POST["name"]))
|
||||
{
|
||||
$this->error=array($langs->trans("ErrorFieldRequired",$langs->transnoentities("Name").' / '.$langs->transnoentities("Label")));
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
if (empty($this->error))
|
||||
{
|
||||
$this->object->fetch($_POST["adherentid"]);
|
||||
|
||||
$this->object->oldcopy=dol_clone($this->object);
|
||||
|
||||
$this->assign_post();
|
||||
|
||||
$result = $this->object->update($_POST["adherentid"], $user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$this->object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors=$this->object->errors;
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set content of ->tpl array, to use into template
|
||||
*
|
||||
* @param string &$action Type of action
|
||||
* @param int $id Id
|
||||
* @return string HTML output
|
||||
*/
|
||||
function assign_values(&$action, $id)
|
||||
{
|
||||
global $conf, $langs, $user, $canvas;
|
||||
global $form, $formcompany, $objsoc;
|
||||
|
||||
if ($action == 'add' || $action == 'update') $this->assign_post();
|
||||
|
||||
foreach($this->object as $key => $value)
|
||||
{
|
||||
$this->tpl[$key] = $value;
|
||||
}
|
||||
|
||||
$this->tpl['error']=$this->error;
|
||||
$this->tpl['errors']=$this->errors;
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#selectcountry_id").change(function() {
|
||||
document.formsoc.action.value="'.$action.'";
|
||||
document.formsoc.canvas.value="'.$canvas.'";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
})
|
||||
</script>'."\n";
|
||||
}
|
||||
|
||||
if (is_object($objsoc) && $objsoc->id > 0)
|
||||
{
|
||||
$this->tpl['company'] = $objsoc->getNomUrl(1);
|
||||
$this->tpl['company_id'] = $objsoc->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['company'] = $form->select_company($this->object->socid,'socid','',1);
|
||||
}
|
||||
|
||||
// Civility
|
||||
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civilite_id);
|
||||
|
||||
// Predefined with third party
|
||||
if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE'))
|
||||
{
|
||||
if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
|
||||
if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;
|
||||
if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town;
|
||||
if (dol_strlen(trim($this->object->phone_perso)) == 0) $this->object->phone_perso = $objsoc->phone;
|
||||
if (dol_strlen(trim($this->object->phone_mobile)) == 0) $this->object->phone_mobile = $objsoc->phone_mobile;
|
||||
if (dol_strlen(trim($this->object->email)) == 0) $this->object->email = $objsoc->email;
|
||||
}
|
||||
|
||||
// Zip
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
|
||||
|
||||
// Town
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id'));
|
||||
|
||||
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
|
||||
|
||||
// Country
|
||||
$this->tpl['select_country'] = $form->select_country($this->object->country_id,'country_id');
|
||||
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
|
||||
// State
|
||||
if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->fk_departement,$this->object->country_code);
|
||||
else $this->tpl['select_state'] = $countrynotdefined;
|
||||
|
||||
// Physical or Moral
|
||||
$selectarray=array('0'=>$langs->trans("Physical"),'1'=>$langs->trans("Moral"));
|
||||
$this->tpl['select_morphy'] = $form->selectarray('morphy',$selectarray,$this->object->morphy,0);
|
||||
}
|
||||
|
||||
if ($action == 'view' || $action == 'edit' || $action == 'delete')
|
||||
{
|
||||
// Emailing
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
$langs->load("mails");
|
||||
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
|
||||
}
|
||||
|
||||
|
||||
// Dolibarr user
|
||||
if ($this->object->user_id)
|
||||
{
|
||||
$dolibarr_user=new User($this->db);
|
||||
$result=$dolibarr_user->fetch($this->object->user_id);
|
||||
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
|
||||
}
|
||||
else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
|
||||
}
|
||||
|
||||
if ($action == 'view' || $action == 'delete')
|
||||
{
|
||||
$this->tpl['showrefnav'] = $form->showrefnav($this->object,'id');
|
||||
|
||||
if ($this->object->socid > 0)
|
||||
{
|
||||
$objsoc = new Societe($this->db);
|
||||
|
||||
$objsoc->fetch($this->object->socid);
|
||||
$this->tpl['company'] = $objsoc->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['company'] = $langs->trans("AdherentNotLinkedToThirdParty");
|
||||
}
|
||||
|
||||
$this->tpl['civility'] = $this->object->getCivilityLabel();
|
||||
|
||||
$this->tpl['address'] = dol_nl2br($this->object->address);
|
||||
|
||||
$this->tpl['zip'] = ($this->object->zip?$this->object->zip.' ':'');
|
||||
|
||||
$img=picto_from_langcode($this->object->country_code);
|
||||
$this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
|
||||
|
||||
$this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso,$this->object->country_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile,$this->object->country_code,0,$this->object->id,'AC_TEL');
|
||||
$this->tpl['email'] = dol_print_email($this->object->email,0,$this->object->id,'AC_EMAIL');
|
||||
|
||||
$this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy);
|
||||
|
||||
$this->tpl['note'] = nl2br($this->object->note);
|
||||
}
|
||||
|
||||
if ($action == 'create_user')
|
||||
{
|
||||
// Full firstname and name separated with a dot : firstname.name
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$login=dol_buildlogin($this->object->nom, $this->object->prenom);
|
||||
|
||||
$generated_password=getRandomPassword('');
|
||||
$password=$generated_password;
|
||||
|
||||
// Create a form array
|
||||
$formquestion=array(
|
||||
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
|
||||
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
|
||||
|
||||
$this->tpl['action_create_user'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateAdherent"),"confirm_create_user",$formquestion,'no');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign POST values into object
|
||||
*
|
||||
* @return string HTML output
|
||||
*/
|
||||
private function assign_post()
|
||||
{
|
||||
global $langs, $mysoc;
|
||||
|
||||
$this->object->old_name = $_POST["old_name"];
|
||||
$this->object->old_firstname = $_POST["old_firstname"];
|
||||
|
||||
$this->object->fk_soc = $_POST["fk_soc"];
|
||||
$this->object->name = $_POST["name"];
|
||||
$this->object->firstname = $_POST["firstname"];
|
||||
$this->object->civilite_id = $_POST["civilite_id"];
|
||||
$this->object->address = $_POST["address"];
|
||||
$this->object->zip = $_POST["zipcode"];
|
||||
$this->object->town = $_POST["town"];
|
||||
$this->object->fk_pays = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->fk_departement = $_POST["departement_id"];
|
||||
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->state_id = $_POST["departement_id"];
|
||||
$this->object->phone_perso = $_POST["phone_perso"];
|
||||
$this->object->phone_mobile = $_POST["phone_mobile"];
|
||||
$this->object->email = $_POST["email"];
|
||||
$this->object->note = $_POST["note"];
|
||||
$this->object->canvas = $_POST["canvas"];
|
||||
|
||||
// We set country_id, and country_code label of the chosen country
|
||||
if ($this->object->country_id)
|
||||
{
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->object->country_id;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$this->object->pays_code = $obj->code;
|
||||
$this->object->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
$this->object->country_code = $obj->code;
|
||||
$this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contact/canvas/default/actions_adherentcard_default.class.php
|
||||
* \ingroup thirdparty
|
||||
* \brief Fichier de la classe Thirdparty adherent card controller (default canvas)
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/adherent/canvas/actions_adherentcard_common.class.php';
|
||||
|
||||
/**
|
||||
* \class ActionsAdherentCardDefault
|
||||
* \brief Classe permettant la gestion des adherents par defaut
|
||||
*/
|
||||
class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
{
|
||||
var $db;
|
||||
var $dirmodule;
|
||||
var $targetmodule;
|
||||
var $canvas;
|
||||
var $card;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Handler acces base de donnees
|
||||
* @param string $dirmodule Name of directory of module
|
||||
* @param string $targetmodule Name of directory of module where canvas is stored
|
||||
* @param string $canvas Name of canvas
|
||||
* @param string $card Name of tab (sub-canvas)
|
||||
*/
|
||||
function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->dirmodule = $dirmodule;
|
||||
$this->targetmodule = $targetmodule;
|
||||
$this->canvas = $canvas;
|
||||
$this->card = $card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the title of card
|
||||
*
|
||||
* @param string $action Code action
|
||||
* @return string Title
|
||||
*/
|
||||
private function getTitle($action)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$out='';
|
||||
|
||||
if ($action == 'view') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
|
||||
if ($action == 'edit') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
|
||||
if ($action == 'create') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas
|
||||
*
|
||||
* @param string &$action Type of action
|
||||
* @param int $id Id
|
||||
* @return void
|
||||
*/
|
||||
function assign_values(&$action, $id)
|
||||
{
|
||||
global $conf, $db, $langs, $user;
|
||||
global $form;
|
||||
|
||||
$ret = $this->getObject($id);
|
||||
|
||||
parent::assign_values($action, $id);
|
||||
|
||||
$this->tpl['title'] = $this->getTitle($action);
|
||||
$this->tpl['error'] = $this->error;
|
||||
$this->tpl['errors']= $this->errors;
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Card header
|
||||
$head = member_prepare_head($this->object);
|
||||
$title = $this->getTitle($action);
|
||||
|
||||
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
|
||||
$this->tpl['showend']=dol_get_fiche_end();
|
||||
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($this->object->socid);
|
||||
|
||||
$this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);
|
||||
|
||||
$this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Confirm delete contact
|
||||
if ($action == 'delete' && $user->rights->adherent->supprimer)
|
||||
{
|
||||
$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id,$langs->trans("DeleteAdherent"),$langs->trans("ConfirmDeleteAdherent"),"confirm_delete",'',0,1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch datas list
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @return void
|
||||
*/
|
||||
function LoadListDatas($limit, $offset, $sortfield, $sortorder)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
//$this->getFieldList();
|
||||
|
||||
$this->list_datas = array();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
1
htdocs/adherents/canvas/default/index.php
Normal file
1
htdocs/adherents/canvas/default/index.php
Normal file
@ -0,0 +1 @@
|
||||
Url not available
|
||||
123
htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
Normal file
123
htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_CREATE.TPL.PHP DEFAULT -->
|
||||
|
||||
<?php
|
||||
print_fiche_titre($this->control->tpl['title']);
|
||||
|
||||
dol_htmloutput_errors((is_numeric($object->error)?'':$object->error),$object->errors);
|
||||
|
||||
dol_htmloutput_errors((is_numeric($GLOBALS['error'])?'':$GLOBALS['error']),$GLOBALS['errors']);
|
||||
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
|
||||
echo $this->control->tpl['ajax_selectcountry']; ?>
|
||||
|
||||
<br>
|
||||
|
||||
<form method="post" name="formmember" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<?php if ($this->control->tpl['company_id']) { ?>
|
||||
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>">
|
||||
<?php } ?>
|
||||
|
||||
<table class="border allwidth">
|
||||
|
||||
<tr>
|
||||
<td width="15%" class="fieldrequired"><?php echo $langs->trans("Lastname").' / '.$langs->trans("Label"); ?></td>
|
||||
<td><input name="lastname" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['name']; ?>"></td>
|
||||
<td width="20%"><?php echo $langs->trans("Firstname"); ?></td>
|
||||
<td width="25%"><input name="firstname" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['firstname']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Company"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("UserTitle"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_civility']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Morphy"); ?></td>
|
||||
<td colspan="3"><input name="morphy" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['select_morphy']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Address"); ?></td>
|
||||
<td colspan="3"><textarea class="flat" name="address" cols="70"><?php echo $this->control->tpl['address']; ?></textarea></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Zip").' / '.$langs->trans("Town"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_zip'].' '.$this->control->tpl['select_town']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Country"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_country'].$this->control->tpl['info_admin']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('State'); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("PhonePro"); ?></td>
|
||||
<td><input name="phone_pro" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_pro']; ?>"></td>
|
||||
<td><?php echo $langs->trans("PhonePerso"); ?></td>
|
||||
<td><input name="phone_perso" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_perso']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("PhoneMobile"); ?></td>
|
||||
<td><input name="phone_mobile" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_mobile']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Email"); ?></td>
|
||||
<td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['email']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_visibility']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" colspan="4"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></td>
|
||||
</tr>
|
||||
|
||||
</table><br>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
140
htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
Normal file
140
htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_EDIT.TPL.PHP DEFAULT -->
|
||||
|
||||
<?php
|
||||
print_fiche_titre($this->control->tpl['title']);
|
||||
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
|
||||
echo $this->control->tpl['ajax_selectcountry'];
|
||||
?>
|
||||
|
||||
<br>
|
||||
|
||||
<form method="post" name="formmember" action="<?php echo $_SERVER["PHP_SELF"].'?id='.GETPOST('id','int'); ?>">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas ?>">
|
||||
<input type="hidden" name="id" value="<?php echo GETPOST('id','int'); ?>">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="adherentid" value="<?php echo $this->control->tpl['id']; ?>">
|
||||
<input type="hidden" name="old_name" value="<?php echo $this->control->tpl['name']; ?>">
|
||||
<input type="hidden" name="old_firstname" value="<?php echo $this->control->tpl['firstname']; ?>">
|
||||
<?php if (! empty($this->control->tpl['company_id'])) { ?>
|
||||
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>">
|
||||
<?php } ?>
|
||||
|
||||
<table class="border allwidth">
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['ref']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="15%" class="fieldrequired"><?php echo $langs->trans("Lastname").' / '.$langs->trans("Label"); ?></td>
|
||||
<td><input name="lastname" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['name']; ?>"></td>
|
||||
<td width="20%"><?php echo $langs->trans("Firstname"); ?></td>
|
||||
<td width="25%"><input name="firstname" type="text" size="30" maxlength="80" value="<?php echo $this->control->tpl['firstname']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Company"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("UserTitle"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_civility']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Morphy"); ?></td>
|
||||
<td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['select_morphy']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Address"); ?></td>
|
||||
<td colspan="3"><textarea class="flat" name="address" cols="70"><?php echo $this->control->tpl['address']; ?></textarea></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Zip").' / '.$langs->trans("Town"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_zip'].' '.$this->control->tpl['select_town']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Country"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_country'].$this->control->tpl['info_admin']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('State'); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_state']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("PhonePro"); ?></td>
|
||||
<td><input name="phone_pro" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_pro']; ?>"></td>
|
||||
<td><?php echo $langs->trans("PhonePerso"); ?></td>
|
||||
<td><input name="phone_perso" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_perso']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("PhoneMobile"); ?></td>
|
||||
<td><input name="phone_mobile" type="text" size="18" maxlength="80" value="<?php echo $this->control->tpl['phone_mobile']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Email"); ?></td>
|
||||
<td><input name="email" type="text" size="50" maxlength="80" value="<?php echo $this->control->tpl['email']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_visibility']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="3" valign="top"><textarea name="note" cols="70" rows="<?php echo ROWS_3; ?>"><?php echo $this->control->tpl['note']; ?></textarea></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("DolibarrLogin"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['dolibarr_user']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="4" align="center">
|
||||
<input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>">
|
||||
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table><br>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
141
htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
Normal file
141
htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
$contact = $GLOBALS['objcanvas']->control->object;
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
|
||||
<?php echo $this->control->tpl['showhead']; ?>
|
||||
|
||||
<?php
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
?>
|
||||
|
||||
<?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
|
||||
<?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
|
||||
|
||||
<table class="border allwidth">
|
||||
|
||||
<tr>
|
||||
<td width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="20%"><?php echo $langs->trans("Lastname"); ?></td>
|
||||
<td width="30%"><?php echo $this->control->tpl['name']; ?></td>
|
||||
<td width="25%"><?php echo $langs->trans("Firstname"); ?></td>
|
||||
<td width="25%"><?php echo $this->control->tpl['firstname']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Company"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("UserTitle"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['civility']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Morphy"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['select_morphy']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Address"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['address']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Zip").' / '.$langs->trans("Town"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['zip'].$this->control->tpl['ville']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Country"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['country']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('State'); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['departement']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("PhonePro"); ?></td>
|
||||
<td><?php echo $this->control->tpl['phone_pro']; ?></td>
|
||||
<td><?php echo $langs->trans("PhonePerso"); ?></td>
|
||||
<td><?php echo $this->control->tpl['phone_perso']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("PhoneMobile"); ?></td>
|
||||
<td><?php echo $this->control->tpl['phone_mobile']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("EMail"); ?></td>
|
||||
<td><?php echo $this->control->tpl['email']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("ContactVisibility"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['visibility']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['note']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("DolibarrLogin"); ?></td>
|
||||
<td colspan="3"><?php echo $this->control->tpl['dolibarr_user']; ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php echo $this->control->tpl['showend']; ?>
|
||||
|
||||
<?php if (! $user->societe_id) { ?>
|
||||
<div class="tabsAction">
|
||||
|
||||
<?php if ($user->rights->adherent->creer) { ?>
|
||||
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&canvas='.$canvas; ?>"><?php echo $langs->trans('Modify'); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { ?>
|
||||
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&canvas='.$canvas; ?>"><?php echo $langs->trans("CreateDolibarrLogin"); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($user->rights->adherent->supprimer) { ?>
|
||||
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
</div><br>
|
||||
<?php }
|
||||
|
||||
echo $this->control->tpl['actionstodo'];
|
||||
|
||||
echo $this->control->tpl['actionsdone'];
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
1
htdocs/adherents/canvas/default/tpl/index.php
Normal file
1
htdocs/adherents/canvas/default/tpl/index.php
Normal file
@ -0,0 +1 @@
|
||||
Url not available
|
||||
1
htdocs/adherents/canvas/index.php
Normal file
1
htdocs/adherents/canvas/index.php
Normal file
@ -0,0 +1 @@
|
||||
Url not available
|
||||
@ -406,7 +406,7 @@ if ($action == 'create')
|
||||
print $desc;
|
||||
print '</td></tr>'."\n";
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td colspan="2">';
|
||||
$html->select_date(0,'','','','',"add",1,1);
|
||||
@ -478,7 +478,7 @@ if ($action == 'create')
|
||||
// Button "Create Draft"
|
||||
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'" /></center>';
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
print "</table>\n";
|
||||
}
|
||||
@ -672,7 +672,7 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs))
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="origin" value="commande"><br>';
|
||||
print '<a class="butAction" href="index.php">'.$langs->trans("GoBack").'</a>';
|
||||
print '<input type="submit" class="button" value='.$langs->trans("GenerateBill").'>';
|
||||
print '<input type="submit" class="butAction" value='.$langs->trans("GenerateBill").'>';
|
||||
print '<center><br><input type="checkbox" checked="checked" name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
@ -1408,7 +1408,7 @@ class Form
|
||||
$langs->load('stocks');
|
||||
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.remise_percent, pfp.remise, pfp.unitprice,";
|
||||
$sql.= " s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
@ -1435,7 +1435,7 @@ class Form
|
||||
$sql .= " OR p.barcode LIKE '".$filterkey."'";
|
||||
}
|
||||
}
|
||||
$sql.= " ORDER BY pfp.ref_fourn DESC";
|
||||
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
|
||||
|
||||
// Build output string
|
||||
$outselect='';
|
||||
@ -1461,6 +1461,7 @@ class Form
|
||||
$outref=$objp->ref;
|
||||
$outval='';
|
||||
$outqty=1;
|
||||
$outdiscount=0;
|
||||
|
||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
||||
@ -1489,6 +1490,7 @@ class Form
|
||||
$opt.= price($objp->fprice).' '.$currencytext."/".$objp->quantity;
|
||||
$outval.= price($objp->fprice).' '.$currencytextnoent."/".$objp->quantity;
|
||||
$outqty=$objp->quantity;
|
||||
$outdiscount=$objp->remise_percent;
|
||||
if ($objp->quantity == 1)
|
||||
{
|
||||
$opt.= strtolower($langs->trans("Unit"));
|
||||
@ -1503,6 +1505,11 @@ class Form
|
||||
{
|
||||
$opt.=" (".price($objp->unitprice).' '.$currencytext."/".strtolower($langs->trans("Unit")).")";
|
||||
$outval.=" (".price($objp->unitprice).' '.$currencytextnoent."/".strtolower($langs->transnoentities("Unit")).")";
|
||||
}
|
||||
if ($objp->remise_percent >= 1)
|
||||
{
|
||||
$opt.=" - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
|
||||
$outval.=" - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
|
||||
}
|
||||
if ($objp->duration)
|
||||
{
|
||||
@ -1526,7 +1533,7 @@ class Form
|
||||
// "key" value of json key array is used by jQuery automatically as selected value
|
||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||
$outselect.=$opt;
|
||||
array_push($outjson, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'disabled'=>(empty($objp->idprodfournprice)?true:false)));
|
||||
array_push($outjson, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'discount'=>$outdiscount, 'disabled'=>(empty($objp->idprodfournprice)?true:false)));
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -3081,7 +3088,6 @@ class Form
|
||||
|
||||
// Now we get list
|
||||
$num = $this->load_cache_vatrates($code_pays);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
|
||||
@ -44,6 +44,8 @@ class ProductFournisseur extends Product
|
||||
var $fourn_ref; // ref supplier
|
||||
var $fourn_qty; // quantity for price
|
||||
var $fourn_price; // price for quantity
|
||||
var $fourn_remise_percent; // discount for quantity (percent)
|
||||
var $fourn_remise; // discount for quantity (amount)
|
||||
var $product_fourn_id; // supplier id
|
||||
var $fk_availability; // availability delay
|
||||
var $fourn_unitprice;
|
||||
@ -133,18 +135,20 @@ class ProductFournisseur extends Product
|
||||
/**
|
||||
* Modify the purchase price for a supplier
|
||||
*
|
||||
* @param int $qty Min quantity for which price is valid
|
||||
* @param float $buyprice Purchase price for the quantity min
|
||||
* @param User $user Object user user made changes
|
||||
* @param int $qty Min quantity for which price is valid
|
||||
* @param float $buyprice Purchase price for the quantity min
|
||||
* @param User $user Object user user made changes
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param Societe $fourn Supplier
|
||||
* @param int $availability Product availability
|
||||
* @param string $ref_fourn Supplier ref
|
||||
* @param float $tva_tx VAT rate
|
||||
* @param string $charges costs affering to product
|
||||
* @param float $remise_percent Discount regarding qty (percent)
|
||||
* @param float $remise Discount regarding qty (amount)
|
||||
* @return int >0 if KO, >0 if OK
|
||||
*/
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0)
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0)
|
||||
{
|
||||
global $conf,$mysoc;
|
||||
|
||||
@ -153,15 +157,16 @@ class ProductFournisseur extends Product
|
||||
if (empty($buyprice)) $buyprice=0;
|
||||
if (empty($charges)) $charges=0;
|
||||
if (empty($availability)) $availability=0;
|
||||
if ($price_base_type == 'TTC')
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$ttx = get_default_tva($fourn,$mysoc,$this->id);
|
||||
//$ttx = get_default_tva($fourn,$mysoc,$this->id); // We must use the VAT rate defined by user and not calculate it
|
||||
$ttx = $tva_tx;
|
||||
$buyprice = $buyprice/(1+($ttx/100));
|
||||
}
|
||||
$buyprice=price2num($buyprice,'MU');
|
||||
$charges=price2num($charges,'MU');
|
||||
$qty=price2num($qty);
|
||||
|
||||
$error=0;
|
||||
|
||||
$unitBuyPrice = price2num($buyprice/$qty,'MU');
|
||||
@ -177,6 +182,8 @@ class ProductFournisseur extends Product
|
||||
$sql.= " SET fk_user = " . $user->id." ,";
|
||||
$sql.= " price = ".price2num($buyprice).",";
|
||||
$sql.= " quantity = ".$qty.",";
|
||||
$sql.= " remise_percent = ".$remise_percent.",";
|
||||
$sql.= " remise = ".$remise.",";
|
||||
$sql.= " unitprice = ".$unitBuyPrice.",";
|
||||
$sql.= " unitcharges = ".$unitCharges.",";
|
||||
$sql.= " tva_tx = ".$tva_tx.",";
|
||||
@ -184,6 +191,7 @@ class ProductFournisseur extends Product
|
||||
$sql.= " entity = ".$conf->entity.",";
|
||||
$sql.= " charges = ".($charges != ''?price2num($charges):"null");
|
||||
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
|
||||
// TODO Add price_base_type and price_ttc
|
||||
|
||||
dol_syslog(get_class($this).'::update_buyprice sql='.$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -211,7 +219,7 @@ class ProductFournisseur extends Product
|
||||
{
|
||||
// Add price for this quantity to supplier
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
|
||||
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, unitprice, tva_tx, fk_availability, entity)";
|
||||
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, fk_availability, entity)";
|
||||
$sql.= " values('".$this->db->idate($now)."',";
|
||||
$sql.= " ".$this->id.",";
|
||||
$sql.= " ".$fourn->id.",";
|
||||
@ -219,6 +227,8 @@ class ProductFournisseur extends Product
|
||||
$sql.= " ".$user->id.",";
|
||||
$sql.= " ".price2num($buyprice).",";
|
||||
$sql.= " ".$qty.",";
|
||||
$sql.= " ".$remise_percent.",";
|
||||
$sql.= " ".$remise.",";
|
||||
$sql.= " ".$unitBuyPrice.",";
|
||||
$sql.= " ".$tva_tx.",";
|
||||
$sql.= " ".$availability.",";
|
||||
@ -280,7 +290,7 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
function fetch_product_fournisseur_price($rowid)
|
||||
{
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.fk_availability,";
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$rowid;
|
||||
@ -297,6 +307,8 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_price = $obj->price;
|
||||
$this->fourn_charges = $obj->charges;
|
||||
$this->fourn_qty = $obj->quantity;
|
||||
$this->fourn_remise_percent = $obj->remise_percent;
|
||||
$this->fourn_remise = $obj->remise;
|
||||
$this->fourn_unitprice = $obj->unitprice;
|
||||
$this->fourn_unitcharges = $obj->unitcharges;
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
@ -323,22 +335,24 @@ class ProductFournisseur extends Product
|
||||
* List all supplier prices of a product
|
||||
*
|
||||
* @param int $prodid Id of product
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @return array Array of Products with new properties to define supplier price
|
||||
*/
|
||||
function list_product_fournisseur_price($prodid)
|
||||
function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
|
||||
$sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id,";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")";
|
||||
$sql.= " AND pfp.fk_soc = s.rowid";
|
||||
$sql.= " AND pfp.fk_product = ".$prodid;
|
||||
$sql.= " ORDER BY s.nom, pfp.quantity, pfp.price";
|
||||
|
||||
if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price";
|
||||
else $sql.= $this->db->order($sortfield,$sortorder);
|
||||
dol_syslog(get_class($this)."::list_product_fournisseur_price sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -356,6 +370,8 @@ class ProductFournisseur extends Product
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->fourn_price = $record["price"];
|
||||
$prodfourn->fourn_qty = $record["quantity"];
|
||||
$prodfourn->fourn_remise_percent = $record["remise_percent"];
|
||||
$prodfourn->fourn_remise = $record["remise"];
|
||||
$prodfourn->fourn_unitprice = $record["unitprice"];
|
||||
$prodfourn->fourn_charges = $record["charges"];
|
||||
$prodfourn->fourn_unitcharges = $record["unitcharges"];
|
||||
@ -406,6 +422,8 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_ref = '';
|
||||
$this->fourn_price = '';
|
||||
$this->fourn_qty = '';
|
||||
$this->fourn_remise_percent = '';
|
||||
$this->fourn_remise = '';
|
||||
$this->fourn_unitprice = '';
|
||||
$this->fourn_id = '';
|
||||
$this->fourn_name = '';
|
||||
@ -431,9 +449,11 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_ref = $record["ref_fourn"];
|
||||
$this->fourn_price = $record["price"];
|
||||
$this->fourn_qty = $record["quantity"];
|
||||
$this->fourn_remise_percent = $record["remise_percent"];
|
||||
$this->fourn_remise = $record["remise"];
|
||||
$this->fourn_unitprice = $record["unitprice"];
|
||||
$this->fourn_charges = $record["charges"];
|
||||
$this->fourn_unitcharges = $record["unitcharges"];
|
||||
$this->fourn_unitcharges = $record["unitcharges"];
|
||||
$this->fourn_tva_tx = $record["tva_tx"];
|
||||
$this->fourn_id = $record["fourn_id"];
|
||||
$this->fourn_name = $record["supplier_name"];
|
||||
@ -453,14 +473,16 @@ class ProductFournisseur extends Product
|
||||
* Display supplier of product
|
||||
*
|
||||
* @param int $withpicto Add picto
|
||||
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier')
|
||||
* @return string String with supplier price
|
||||
* TODO Remove this method. Use getNomUrl directly.
|
||||
*/
|
||||
function getSocNomUrl($withpicto=0)
|
||||
function getSocNomUrl($withpicto=0,$option='supplier')
|
||||
{
|
||||
$cust = new Fournisseur($this->db);
|
||||
$cust->fetch($this->fourn_id);
|
||||
|
||||
return $cust->getNomUrl($withpicto);
|
||||
return $cust->getNomUrl($withpicto,$option);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1533,7 +1533,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td colspan="3">';
|
||||
|
||||
$ajaxoptions=array(
|
||||
'update' => array('pqty' => 'qty'),
|
||||
'update' => array('pqty' => 'qty', 'p_remise_percent' => 'discount'),
|
||||
'option_disabled' => 'addPredefinedProductButton',
|
||||
'error' => $langs->trans("NoPriceDefinedForThisSupplier")
|
||||
);
|
||||
@ -1554,7 +1554,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" size="2" id="pqty" name="pqty" value="'.(GETPOST('pqty')?GETPOST('pqty'):'1').'"></td>';
|
||||
print '<td align="right" nowrap="nowrap"><input type="text" size="1" name="p_remise_percent" value="'.(GETPOST('p_remise_percent')?GETPOST('p_remise_percent'):$soc->remise_client).'">%</td>';
|
||||
print '<td align="right" nowrap="nowrap"><input type="text" size="1" id="p_remise_percent" name="p_remise_percent" value="'.(GETPOST('p_remise_percent')?GETPOST('p_remise_percent'):$soc->remise_client).'">%</td>';
|
||||
print '<td align="center" colspan="4"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans('Add').'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -1819,7 +1819,7 @@ else
|
||||
print '<td colspan="4">';
|
||||
|
||||
$ajaxoptions=array(
|
||||
'update' => array('pqty' => 'qty'),
|
||||
'update' => array('pqty' => 'qty', 'p_remise_percent' => 'discount'),
|
||||
'disabled' => 'addPredefinedProductButton',
|
||||
'error' => $langs->trans("NoPriceDefinedForThisSupplier")
|
||||
);
|
||||
@ -1840,7 +1840,7 @@ else
|
||||
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" id="pqty" name="qty" value="1" size="1"></td>';
|
||||
print '<td align="right" nowrap="nowrap"><input size="1" name="remise_percent" type="text" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):'0').'">%</td>';
|
||||
print '<td align="right" nowrap="nowrap"><input size="1" id="p_remise_percent" name="remise_percent" type="text" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):'0').'">%</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center" valign="middle" colspan="2"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
|
||||
@ -742,3 +742,7 @@ insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype,
|
||||
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (436,'PCG99-BASE','PROD', 'XXXXXX', '791','79', 'Transferts de charges d''exploitation ', '1');
|
||||
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (437,'PCG99-BASE','PROD', 'XXXXXX', '796','79', 'Transferts de charges financières', '1');
|
||||
insert into llx_accountingaccount (rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (438,'PCG99-BASE','PROD', 'XXXXXX', '797','79', 'Transferts de charges exceptionnelles', '1');
|
||||
|
||||
-- Add discount in product supplier price
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN remise_percent DOUBLE NOT NULL DEFAULT 0 AFTER quantity;
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN remise DOUBLE NOT NULL DEFAULT 0 AFTER remise_percent;
|
||||
|
||||
@ -145,7 +145,9 @@ Restock=Restock
|
||||
ProductSpecial=Special
|
||||
QtyMin=Quantity minimum
|
||||
PriceQty=Price for this quantity
|
||||
PriceQtyMin=Price quantity min.
|
||||
PriceQtyMin=Price quantity min. (without discount)
|
||||
VATRateForSupplierProduct=VAT Rate (for this supplier/product)
|
||||
DiscountQtyMin=Discount quantity min. (by default)
|
||||
NoPriceDefinedForThisSupplier=No price/qty defined for this supplier/product
|
||||
NoSupplierPriceDefinedForThisProduct=No supplier price/qty defined for this product
|
||||
RecordedProducts=Products recorded
|
||||
|
||||
@ -145,7 +145,9 @@ Restock=Réassort
|
||||
ProductSpecial=Special
|
||||
QtyMin=Quantité minimum
|
||||
PriceQty=Prix pour la quantité
|
||||
PriceQtyMin=Prix quantité min.
|
||||
PriceQtyMin=Prix quantité min. (sans remise)
|
||||
DiscountQtyMin=Remise par défaut quantité min.
|
||||
VATRateForSupplierProduct=Taux TVA (pour ce produit/fournisseur)
|
||||
NoPriceDefinedForThisSupplier=Aucun prix/qté défini pour ce fournisseur/produit
|
||||
NoSupplierPriceDefinedForThisProduct=Aucun prix/qté fournisseur défini pour ce produit
|
||||
RecordedProducts=Produits en vente
|
||||
|
||||
@ -1084,10 +1084,11 @@ else
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
||||
|
||||
$nblignes=8;
|
||||
if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) $nblignes++;
|
||||
if ($showbarcode) $nblignes+=2;
|
||||
if ($object->type!=1) $nblignes++;
|
||||
if ($object->isservice()) $nblignes++;
|
||||
else $nblignes+=4;
|
||||
if ($showbarcode) $nblignes+=2;
|
||||
|
||||
// Photo
|
||||
if ($showphoto || $showbarcode)
|
||||
|
||||
@ -94,6 +94,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
||||
$ref_fourn=GETPOST("ref_fourn");
|
||||
if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn");
|
||||
$quantity=GETPOST("qty");
|
||||
$remise_percent=price2num(GETPOST('remise_percent','alpha'));
|
||||
$tva_tx=price2num(GETPOST('tva_tx','alpha'));
|
||||
|
||||
if (empty($quantity))
|
||||
@ -152,11 +153,10 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
|
||||
{
|
||||
$supplier=new Fournisseur($db);
|
||||
$result=$supplier->fetch($id_fourn);
|
||||
if (isset($_POST['ref_fourn_price_id']))
|
||||
$product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
||||
|
||||
if (isset($_POST['ref_fourn_price_id']))
|
||||
$product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
||||
|
||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"]);
|
||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -272,7 +272,7 @@ if ($id || $ref)
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Supplier").'</td><td colspan="5">';
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Supplier").'</td><td>';
|
||||
if ($rowid)
|
||||
{
|
||||
$supplier=new Fournisseur($db);
|
||||
@ -297,7 +297,7 @@ if ($id || $ref)
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td colspan="5">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td>';
|
||||
if ($rowid)
|
||||
{
|
||||
print $product->fourn_ref;
|
||||
@ -309,18 +309,11 @@ if ($id || $ref)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Vat rate
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td colspan="3">';
|
||||
//print $form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc); // Do not use list here as it may be any vat rates for any country
|
||||
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.vatrate(GETPOST("tva_tx")?GETPOST("tva_tx"):$product->tva_tx).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Availability
|
||||
if (! empty($conf->global->FOURN_PRODUCT_AVAILABILITY))
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<tr><td>'.$langs->trans("Availability").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Availability").'</td><td>';
|
||||
$form->select_availability($product->fk_availability,"oselDispo",1);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
@ -339,14 +332,42 @@ if ($id || $ref)
|
||||
{
|
||||
print '<input class="flat" name="qty" size="5" value="'.$quantity.'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Vat rate
|
||||
$default_vat='';
|
||||
|
||||
// We don't have supplier, so we try to guess.
|
||||
// For this we build a fictive supplier with same properties than user but using vat)
|
||||
$mysoc2=dol_clone($mysoc);
|
||||
$mysoc2->tva_assuj=1;
|
||||
$default_vat=get_default_tva($mysoc2, $mysoc, 0, $product->id);
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("VATRateForSupplierProduct").'</td>';
|
||||
print '<td>';
|
||||
//print $form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc); // Do not use list here as it may be any vat rates for any country
|
||||
if (! empty($socid)) // When update
|
||||
{
|
||||
$supplierselected=new Societe($db);
|
||||
$supplierselected->fetch($socid);
|
||||
$default_vat=get_default_tva($supplier, $mysoc, $product->id);
|
||||
}
|
||||
if ($action == 'add_price' && $socid) $default_vat=$product->tva_tx; // If editing product-fourn
|
||||
print '<input type="text" class="flat" size="5" name="tva_tx" value="'.(GETPOST("tva_tx")?vatrate(GETPOST("tva_tx")):($default_vat!=''?vatrate($default_vat):'')).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Price qty min
|
||||
print '<td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
|
||||
print '<td><input class="flat" name="price" size="8" value="'.(GETPOST('price')?price(GETPOST('price')):(isset($product->fourn_price)?price($product->fourn_price):'')).'">';
|
||||
print ' ';
|
||||
print $form->select_PriceBaseType((GETPOST('price_base_type')?GETPOST('price_base_type'):$product->price_base_type), "price_base_type");
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Discount qty min
|
||||
print '<tr><td>'.$langs->trans("DiscountQtyMin").'</td>';
|
||||
print '<td><input class="flat" name="remise_percent" size="4" value="'.(GETPOST('remise_percent')?vatrate(GETPOST('remise_percent')):(isset($product->fourn_remise_percent)?vatrate($product->fourn_remise_percent):'')).'"> %';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Charges ????
|
||||
@ -354,7 +375,7 @@ if ($id || $ref)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Charges").'</td>';
|
||||
print '<td colspan="3"><input class="flat" name="charges" size="8" value="'.(GETPOST('charges')?price(GETPOST('charges')):(isset($product->fourn_charges)?price($product->fourn_charges):'')).'">';
|
||||
print '<td><input class="flat" name="charges" size="8" value="'.(GETPOST('charges')?price(GETPOST('charges')):(isset($product->fourn_charges)?price($product->fourn_charges):'')).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -407,13 +428,14 @@ if ($id || $ref)
|
||||
// Charges ????
|
||||
if (! empty($conf->margin->enabled)) print '<td align="right">'.$langs->trans("Charges").'</td>';
|
||||
print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("DiscountQtyMin").'</td>';
|
||||
// Charges ????
|
||||
if (! empty($conf->margin->enabled)) print '<td align="right">'.$langs->trans("UnitCharges").'</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$product_fourn = new ProductFournisseur($db);
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($product->id);
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($product->id, $sortfield, $sortorder);
|
||||
|
||||
if (count($product_fourn_list)>0)
|
||||
{
|
||||
@ -425,7 +447,7 @@ if ($id || $ref)
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>'.$productfourn->getSocNomUrl(1).'</td>';
|
||||
print '<td>'.$productfourn->getSocNomUrl(1,'supplier').'</td>';
|
||||
|
||||
// Supplier
|
||||
print '<td align="left">'.$productfourn->fourn_ref.'</td>';
|
||||
@ -467,6 +489,11 @@ if ($id || $ref)
|
||||
//print $objp->unitprice? price($objp->unitprice) : ($objp->quantity?price($objp->price/$objp->quantity):" ");
|
||||
print '</td>';
|
||||
|
||||
// Discount
|
||||
print '<td align="right">';
|
||||
print price2num($productfourn->fourn_remise_percent).'%';
|
||||
print '</td>';
|
||||
|
||||
// Unit Charges ???
|
||||
if (! empty($conf->margin->enabled))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user