Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Florian HENRY 2015-04-18 19:13:56 +02:00
commit e704e03726
7 changed files with 134 additions and 36 deletions

View File

@ -155,7 +155,7 @@ if (empty($reshook))
if ($action == 'setoutstanding_limit')
{
$object->fetch($id);
$object->outstanding_limit=GETPOST('setoutstanding_limit');
$object->outstanding_limit=GETPOST('outstanding_limit');
$result=$object->set_OutstandingBill($user);
if ($result < 0) setEventMessage($object->error,'errors');
}

View File

@ -579,6 +579,103 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
}
}
/*
* Opened Order
*/
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$langs->load("order");
$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total as total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
$sql.= " AND c.fk_statut = 1";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY c.rowid DESC";
$result=$db->query($sql);
if ($result)
{
$total = 0;
$num = $db->num_rows($result);
$i = 0;
if ($num > 0)
{
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></td></tr>';
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
while ($i < $nbofloop)
{
$obj = $db->fetch_object($result);
$var=!$var;
print '<tr '.$bc[$var].'>';
// Ref
print '<td class="nowrap" width="140">';
$orderstatic->id=$obj->commandeid;
$orderstatic->ref=$obj->ref;
$orderstatic->ref_client=$obj->ref_client;
$orderstatic->total_ht = $obj->total_ht;
$orderstatic->total_tva = $obj->total_tva;
$orderstatic->total_ttc = $obj->total_ttc;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
print $orderstatic->getNomUrl(1);
print '</td>';
print '<td width="18" class="nobordernopadding nowrap">';
//if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td width="16" align="center" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir);
print '</td></tr></table>';
print "</td>";
print '<td class="nowrap">';
$companystatic->id=$obj->rowid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1, 'company', 44);
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
print '</tr>'."\n";
$i++;
$total += $obj->total_ttc;
}
if ($num > $nbofloop)
{
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
}
else if ($total>0)
{
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
}
print "</table><br>";
}
}
else
{
dol_print_error($db);
}
}
print '</div></div></div>';

View File

@ -3350,25 +3350,26 @@ abstract class CommonObject
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
$sql.= " WHERE rowid =".$rowid;
$sql.= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
if ($this->db->query($sql))
{
if (! $notrigger)
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
else
{
if (! $notrigger)
{
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
if ($result < 0) { $this->db->rollback(); return -1; }
}
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
$this->db->commit();
return 1;
}
}

View File

@ -218,9 +218,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
// Tools
$tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)),
'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)),
'module'=>'mailing|export|import|opensurvey');
$tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled) || ! empty($conf->resource->enabled)),
'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read) || ! empty($user->rights->resource->read)),
'module'=>'mailing|export|import|opensurvey|resource');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{

View File

@ -61,7 +61,7 @@ class modResource extends DolibarrModules
// (where XXX is value of numeric property 'numero' of module)
$this->description = "Manage resources (printers, cars, room, ...) you can then share into events";
// Possible values for version are: 'development', 'experimental' or version
$this->version = 'development';
$this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled
// (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
@ -114,8 +114,7 @@ class modResource extends DolibarrModules
$this->requiredby = array('modPlace');
// Minimum version of PHP required by module
$this->phpmin = array(5, 3);
// Minimum version of Dolibarr required by module
$this->need_dolibarr_version = array(3, 5);
$this->langfiles = array("resource@resource"); // langfiles@resource
// Constants
// List of particular constants to add when module is enabled

View File

@ -90,7 +90,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print img_edit();
print '</a>';
print '&nbsp;';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print img_delete();
print '</a>';
print '</div>';

View File

@ -59,7 +59,7 @@ $hookmanager->initHooks(array('element_resource'));
$object->available_resources = array('resource');
// Get parameters
$id = GETPOST('id','int');
$id = GETPOST('id','int');
$action = GETPOST('action','alpha');
$mode = GETPOST('mode','alpha');
$lineid = GETPOST('lineid','int');
@ -70,6 +70,7 @@ $resource_type = GETPOST('resource_type','alpha');
$busy = GETPOST('busy','int');
$mandatory = GETPOST('mandatory','int');
$cancel = GETPOST('cancel','alpha');
$confirm = GETPOST('confirm','alpha');
if($action == 'add_element_resource' && ! $cancel)
{
@ -113,22 +114,22 @@ if ($action == 'update_linked_resource' && $user->rights->resource->write && !GE
}
// Delete a resource linked to an element
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes')
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && $confirm === 'yes')
{
$res = $object->fetch(GETPOST('id'));
if($res)
$res = $object->fetch($id);
if($res > 0)
{
$result = $object->delete_resource($lineid,$element);
$result = $object->delete_resource($lineid,$element);
if ($result >= 0)
{
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
Header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id);
exit;
}
else {
setEventMessage($object->error,'errors');
}
if ($result >= 0)
{
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
Header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id);
exit;
}
else {
setEventMessage($object->error,'errors');
}
}
else
{
@ -173,7 +174,7 @@ else
// Confirmation suppression resource line
if ($action == 'delete_resource')
{
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_linked_resource",'','',1);
print $form->formconfirm("element_resource.php?element=".$element."&element_id=".$element_id."&id=".$id."&lineid=".$lineid,$langs->trans("DeleteResource"),$langs->trans("ConfirmDeleteResourceElement"),"confirm_delete_linked_resource",'','',1);
}