Skip to content

Commit

Permalink
The new banner tab is available on all tabs of thirdparty.
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Oct 13, 2015
1 parent 918d9b7 commit a84ec64
Show file tree
Hide file tree
Showing 18 changed files with 249 additions and 459 deletions.
43 changes: 4 additions & 39 deletions htdocs/comm/card.php
Expand Up @@ -218,17 +218,15 @@
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company');


dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');

print '<div class="fichecenter"><div class="fichehalfleft">';


print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';

print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>';

// Alias name (commercial, trademark or alias name)
print '<tr><td>'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print '<tr><td class="titelfield">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print $object->name_alias;
print "</td></tr>";

Expand Down Expand Up @@ -264,39 +262,6 @@
print '</tr>';
}

// Address
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
dol_print_address($object->address,'gmap','thirdparty',$object->id);
print "</td></tr>";

// Zip / Town
print '<tr><td class="nowrap">'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td>';
print '<td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town."</td>";
print '</tr>';

// Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
if (! empty($object->country_code))
{
//$img=picto_from_langcode($object->country_code);
$img='';
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country;
}
print '</td></tr>';

// EMail
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'</td></tr>';

// Web
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">'.dol_print_url($object->url,'_blank').'</td></tr>';

// Phone
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';

// Fax
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';

// Skype
if (! empty($conf->skype->enabled))
{
Expand Down
49 changes: 24 additions & 25 deletions htdocs/comm/remise.php
Expand Up @@ -52,9 +52,9 @@

if (GETPOST("action") == 'setremise')
{
$soc = New Societe($db);
$soc->fetch($_GET["id"]);
$result=$soc->set_remise_client($_POST["remise"],$_POST["note"],$user);
$object = new Societe($db);
$object->fetch($_GET["id"]);
$result=$object->set_remise_client($_POST["remise"],$_POST["note"],$user);

if ($result > 0)
{
Expand All @@ -71,7 +71,7 @@
}
else
{
setEventMessage($soc->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}

Expand All @@ -93,51 +93,50 @@
if ($socid > 0)
{
// On recupere les donnees societes par l'objet
$objsoc = new Societe($db);
$objsoc->id=$socid;
$objsoc->fetch($socid);
$object = new Societe($db);
$object->fetch($socid);

$head = societe_prepare_head($objsoc);
$head = societe_prepare_head($object);



print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<form method="POST" action="remise.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';

dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');


print '<table class="border" width="100%">';

// Name
print '<tr><td colspan="2" width="25%">'.$langs->trans('Name').'</td>';
print '<td colspan="2">';
print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
print '</td></tr>';
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');

print '<div class="fichecenter">';

print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';

// Remise
print '<tr><td colspan="2" width="25%">';
print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.price2num($objsoc->remise_percent)."%</td></tr>";
print '<tr><td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";

print '</table>';
print '<br>';

print load_fiche_titre($langs->trans("NewRelativeDiscount"),'','');

print '<table class="border" width="100%">';
print '<table class="border centpercent">';

// Nouvelle valeur
print '<tr><td colspan="2">';
print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.($_POST["remise"]?$_POST["remise"]:'').'">%</td></tr>';
print '<tr><td class="titlefield">';
print $langs->trans("NewValue").'</td><td><input type="text" size="5" name="remise" value="'.($_POST["remise"]?$_POST["remise"]:'').'">%</td></tr>';

// Motif/Note
print '<tr><td colspan="2" width="25%">';
print $langs->trans("NoteReason").'</td><td colspan="2"><input type="text" size="60" name="note" value="'.$_POST["note"].'"></td></tr>';
print '<tr><td>';
print $langs->trans("NoteReason").'</td><td><input type="text" size="60" name="note" value="'.$_POST["note"].'"></td></tr>';

print "</table>";

print '</div>';

dol_fiche_end();

print '<div class="center">';
Expand All @@ -160,7 +159,7 @@
$sql = "SELECT rc.rowid, rc.remise_client as remise_percent, rc.note, rc.datec as dc,";
$sql.= " u.login, u.rowid as user_id";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND u.rowid = rc.fk_user_author";
$sql.= " ORDER BY rc.datec DESC";

Expand Down
46 changes: 23 additions & 23 deletions htdocs/comm/remx.php
Expand Up @@ -36,7 +36,7 @@
$backtopage=GETPOST('backtopage','alpha');

// Security check
$socid = GETPOST('id','int');
$socid = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int');
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
Expand Down Expand Up @@ -212,36 +212,34 @@
if ($socid > 0)
{
// On recupere les donnees societes par l'objet
$objsoc = new Societe($db);
$objsoc->id=$socid;
$objsoc->fetch($socid);
$object = new Societe($db);
$object->fetch($socid);

/*
* Affichage onglets
*/
$head = societe_prepare_head($objsoc);
$head = societe_prepare_head($object);


print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';

dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');

print '<table class="border" width="100%">';

// Name
print '<tr><td width="38%">'.$langs->trans('Name').'</td>';
print '<td>';
print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
print '</td></tr>';
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');

print '<div class="fichecenter">';

print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';

// Calcul avoirs en cours
$remise_all=$remise_user=0;
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
$sql.= " GROUP BY rc.fk_user";
$resql=$db->query($sql);
Expand All @@ -256,7 +254,7 @@
dol_print_error($db);
}

print '<tr><td width="38%">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';

print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
Expand All @@ -271,13 +269,15 @@
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$objsoc);
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';

print "</table>";

print '</div>';

dol_fiche_end();

print '<div class="center">';
Expand All @@ -296,7 +296,7 @@

if ($_GET['action'] == 'remove')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
}

/*
Expand All @@ -309,7 +309,7 @@
$sql.= " fa.facnumber as ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND u.rowid = rc.fk_user";
$sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
$sql.= " ORDER BY rc.datec DESC";
Expand Down Expand Up @@ -375,9 +375,9 @@
if ($user->rights->societe->creer || $user->rights->facture->creer)
{
print '<td class="nowrap">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=split&amp;remid='.$obj->rowid.'">'.img_picto($langs->trans("SplitDiscount"),'split').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=split&amp;remid='.$obj->rowid.'">'.img_picto($langs->trans("SplitDiscount"),'split').'</a>';
print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '</td>';
}
else print '<td>&nbsp;</td>';
Expand All @@ -403,7 +403,7 @@
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
}
}
else
Expand All @@ -429,7 +429,7 @@
$sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
$sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND rc.fk_facture_line = fc.rowid";
$sql.= " AND fc.fk_facture = f.rowid";
$sql.= " AND rc.fk_user = u.rowid";
Expand All @@ -446,7 +446,7 @@
$sql2.= " , ".MAIN_DB_PREFIX."user as u";
$sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql2.= " WHERE rc.fk_soc =". $objsoc->id;
$sql2.= " WHERE rc.fk_soc =". $object->id;
$sql2.= " AND rc.fk_facture = f.rowid";
$sql2.= " AND rc.fk_user = u.rowid";

Expand Down
20 changes: 10 additions & 10 deletions htdocs/core/lib/company.lib.php
Expand Up @@ -58,6 +58,16 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'customer';
$h++;
}
if (($object->client==1 || $object->client==2 || $object->client==3) && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)))
{
$langs->load("products");
// price
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
$head[$h][1] = $langs->trans("CustomerPrices");
$head[$h][2] = 'price';
$h++;
}

if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
{
$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
Expand Down Expand Up @@ -169,16 +179,6 @@ function societe_prepare_head(Societe $object)
$h++;
}

if (($object->client==1 || $object->client==2 || $object->client==3) && (! empty ( $conf->global->PRODUIT_CUSTOMER_PRICES )))
{
$langs->load("products");
// price
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
$head[$h][1] = $langs->trans("CustomerPrices");
$head[$h][2] = 'price';
$h++;
}

// Log
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Info");
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/tpl/notes.tpl.php
Expand Up @@ -21,7 +21,7 @@
$note_public = 'note_public';
$note_private = 'note_private';

$colwidth=(isset($colwidth)?$colwidth:25);
$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));

$permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page
$moreparam=(isset($moreparam)?$moreparam:'');
Expand Down Expand Up @@ -69,12 +69,12 @@
<!-- BEGIN PHP TEMPLATE NOTES -->
<div class="border table-border centpercent">
<div class="table-border-row">
<div class="table-key-border-col"<?php echo ' style="width: '.$colwidth.'%"'; ?>><?php echo $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-key-border-col<?php echo (empty($cssclass)?'':' '.$cssclass); ?>"<?php echo ($colwidth ? ' style="width: '.$colwidth.'%"' : ''); ?>><?php echo $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam); ?></div>
</div>
<?php if (empty($user->societe_id)) { ?>
<div class="table-border-row">
<div class="table-key-border-col"<?php echo ' style="width: '.$colwidth.'%"'; ?>><?php echo $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-key-border-col<?php echo (empty($cssclass)?'':' '.$cssclass); ?>"<?php echo ($colwidth ? ' style="width: '.$colwidth.'%"' : ''); ?>><?php echo $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam); ?></div>
</div>
<?php } ?>
Expand Down

0 comments on commit a84ec64

Please sign in to comment.