Skip to content

Commit

Permalink
Major enhancement of project module
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 14, 2009
1 parent 54449e3 commit e40fe71
Show file tree
Hide file tree
Showing 29 changed files with 1,164 additions and 775 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -13,6 +13,7 @@ For users:
- New: No limit on free text on PDF generated documents.
- New: Can force login value when creating a user from a member.
- New: Can clone a commercial proposal.
- New: Major enhancement of project module.
- Fix: Failed to go on the future view of bank transaction if there is no
future bank transaction already wrote.
- Fix: Bad ref in supplier list.
Expand Down
54 changes: 27 additions & 27 deletions htdocs/fourn/fournisseur.facture.class.php
Expand Up @@ -55,7 +55,7 @@ class FactureFournisseur extends Facture
var $statut;
//! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant)
var $paye;

var $author;
var $libelle;
var $date;
Expand Down Expand Up @@ -123,7 +123,7 @@ function create($user)
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn (facnumber, libelle, fk_soc, datec, datef, note, fk_user_author, date_lim_reglement) ';
$sql .= " VALUES ('".addslashes($number)."','".addslashes($this->libelle)."',";
$sql .= $this->socid.", ".$this->db->idate(mktime()).",'".$this->db->idate($this->date)."','".addslashes($this->note)."', ".$user->id.",'".$this->db->idate($this->date_echeance)."');";

dolibarr_syslog("FactureFournisseur::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
Expand All @@ -133,13 +133,13 @@ function create($user)
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.');';

dolibarr_syslog("FactureFournisseur::create sql=".$sql, LOG_DEBUG);
$resql_insert=$this->db->query($sql);
if ($resql_insert)
{
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');

$this->updateline($idligne,
$this->lignes[$i]->description,
$this->lignes[$i]->pu_ht,
Expand Down Expand Up @@ -241,7 +241,7 @@ function fetch($rowid)
if ($result < 0)
{
$this->error=$this->db->error();
dolibarr_syslog('FactureFournisseur::Fetch Error '.$this->error, LOG_ERROR);
dolibarr_syslog('FactureFournisseur::Fetch Error '.$this->error, LOG_ERR);
return -3;
}
return 1;
Expand All @@ -263,7 +263,7 @@ function fetch($rowid)
}
}


/**
* \brief Load this->lignes
* \return int 1 si ok, < 0 si erreur
Expand Down Expand Up @@ -319,8 +319,8 @@ function fetch_lines()
return -3;
}
}


/**
* \brief Recup�re l'objet fournisseur li� � la facture
*
Expand All @@ -339,7 +339,7 @@ function fetch_fournisseur()
function delete($rowid)
{
$this->db->begin();

$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';';
dolibarr_syslog("FactureFournisseur sql=".$sql);
$resql = $this->db->query($sql);
Expand Down Expand Up @@ -398,7 +398,7 @@ function set_payed($user)
function set_valid($user)
{
global $conf,$langs;

$this->db->begin();

$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
Expand All @@ -410,7 +410,7 @@ function set_valid($user)
if ($resql)
{
$error=0;

// Si activé on décrémente le produit principal et ses composants à la validation de facture
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)
{
Expand All @@ -428,7 +428,7 @@ function set_valid($user)
}
}
}

if ($error == 0)
{
// Appel des triggers
Expand All @@ -438,7 +438,7 @@ function set_valid($user)
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}

if ($error == 0)
{
$this->db->commit();
Expand Down Expand Up @@ -487,7 +487,7 @@ function addline($desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $da
// Nettoyage param�tres
if ($txtva == '') $txtva=0;
$txtva=price2num($txtva);


$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.');';
Expand Down Expand Up @@ -560,7 +560,7 @@ function updateline($id, $label, $pu, $tauxtva, $qty=1, $idproduct=0, $price_bas
$result=$product->fetch($idproduct);
$product_type=$product->type;
}

$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det ';
$sql.= 'SET ';
$sql.= 'description =\''.addslashes($label).'\'';
Expand Down Expand Up @@ -651,7 +651,7 @@ function info($id)
dolibarr_print_error($this->db);
}
}


/**
* \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord
Expand All @@ -663,7 +663,7 @@ function load_board($user)
global $conf, $user;

$now=gmmktime();

$this->nbtodo=$this->nbtodolate=0;
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin';
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
Expand Down Expand Up @@ -701,9 +701,9 @@ function load_board($user)
function getNomUrl($withpicto=0,$option='')
{
global $langs;

$result='';

$lien = '<a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$this->id.'">';
$lienfin='</a>';

Expand All @@ -712,7 +712,7 @@ function getNomUrl($withpicto=0,$option='')
return $result;
}


/**
* \brief Initialise la facture avec valeurs fictives al�atoire
* Sert � g�n�rer une facture pour l'aperu des mod�les ou demo
Expand Down Expand Up @@ -786,7 +786,7 @@ function initAsSpecimen()
$this->total_tva = $xnbp*19.6;
$this->total_ttc = $xnbp*119.6;
}

/**
* \brief Load an object from its id and create a new one in database
* \param fromid Id of object to clone
Expand All @@ -807,7 +807,7 @@ function createFromClone($fromid,$invertdetail=0)
$object->fetch($fromid);
$object->id=0;
$object->statut=0;

// Clear fields
$object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier;
$object->author = $user->id;
Expand All @@ -819,7 +819,7 @@ function createFromClone($fromid,$invertdetail=0)
$object->ref_client = '';
$object->close_code = '';
$object->close_note = '';

// Create clone
$result=$object->create($user);

Expand All @@ -832,9 +832,9 @@ function createFromClone($fromid,$invertdetail=0)

if (! $error)
{



}

// End
Expand All @@ -849,6 +849,6 @@ function createFromClone($fromid,$invertdetail=0)
return -1;
}
}

}
?>
98 changes: 97 additions & 1 deletion htdocs/html.formother.class.php
@@ -1,6 +1,6 @@
<?php
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
Expand Down Expand Up @@ -153,6 +153,102 @@ function select_ecotaxes($selected='',$htmlname='ecotaxe_id')
}
}


/**
* \brief Retourn list of project and tasks
* \param selected Pre-selected value
* \param modeproject 1 to restrict on projects owned by user
* \param modetask 1 to restrict on tasks associated to user
* \param htmlname Name of html select
*/
function selectProjectTasks($selected='',$htmlname='task_parent', $modeproject=0, $modetask=0)
{
global $user;

require_once(DOL_DOCUMENT_ROOT."/project.class.php");

//print $modeproject.'-'.$modetask;
$project=new Project($this->db);
$tasksarray=$project->getTasksArray($modetask?$user:0, $modeproject?$user:0);
if ($tasksarray)
{
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="0" selected="true">&nbsp;</option>';
$j=0;
$level=0;
PLineSelect($j, 0, $tasksarray, $level);
print '</select>';
}
}
}


/**
* Enter description here...
*
* @param unknown_type $inc
* @param unknown_type $parent
* @param unknown_type $lines
* @param unknown_type $level
*/
function PLineSelect(&$inc, $parent, $lines, &$level)
{
global $langs;

$lastprojectid=0;

for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0) $level = 0;

if ($lines[$i]->fk_parent == $parent)
{
$var = !$var;

// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
{
print '<option value="'.$lines[$i]->projectid.'_0">';
print $langs->trans("Project").' '.$lines[$i]->projectref;
if ($lines[$i]->name || $lines[$i]->fistname)
{
//print ' ('.$lines[$i]->name.($lines[$i]->name && $lines[$i]->firstname?' ':'').$lines[$i]->firstname.')';
}
else
{
print ' ('.$langs->trans("SharedProject").')';
}
//print '-'.$parent.'-'.$lines[$i]->projectid.'-'.$lastprojectid;
print "</option>\n";

$lastprojectid=$lines[$i]->projectid;
$inc++;
}

print '<option value="'.$lines[$i]->projectid.'_'.$lines[$i]->id.'">';
print $langs->trans("Project").' '.$lines[$i]->projectref;
if ($lines[$i]->name || $lines[$i]->fistname)
{
//print ' ('.$lines[$i]->name.($lines[$i]->name && $lines[$i]->firstname?' ':'').$lines[$i]->firstname.')';
}
else
{
print ' ('.$langs->trans("SharedProject").')';
}
if ($lines[$i]->id) print ' > ';
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print $lines[$i]->title."</option>\n";

$inc++;

$level++;
if ($lines[$i]->id) PLineSelect($inc, $lines[$i]->id, $lines, $level);
$level--;
}
}
}

?>
16 changes: 11 additions & 5 deletions htdocs/includes/menus/barre_left/eldy_backoffice.php
Expand Up @@ -766,13 +766,19 @@ function showmenu()
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);

$newmenu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);

$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);

$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
}
}

Expand Down
16 changes: 11 additions & 5 deletions htdocs/includes/menus/barre_left/eldy_frontoffice.php
Expand Up @@ -735,13 +735,19 @@ function showmenu()
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);

$newmenu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);

$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);

$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
}
}

Expand Down

0 comments on commit e40fe71

Please sign in to comment.