Hello list,

since some of my friends kept asking which movies they've borrowed from me in the past, i quickly added
this feature to my install of VDB. The following steps are against a modified 3.0.3 install, and may be useful
for you too. I haven't made an official diff, but can if there's any interest.
Constructive feedback is always appreciated :-)

File borrow.php around line 28
Add:
            $SQL    = "INSERT INTO ".TBL_LENTED." SELECT * FROM ".TBL_LENT." WHERE diskid = '".addslashes($diskid)."'";
            runSQL($SQL);
After:
        if ($return) {
Before:
           $SQL    = "DELETE FROM ".TBL_LENT." WHERE diskid = '".addslashes($diskid)."'";
            runSQL($SQL);
        }

In file core/constants.php around line 48
Add:
    define('TBL_LENTED',          $config['db_prefix'].'lented');
After:
    define('TBL_LENT',          $config['db_prefix'].'lent');

In file show.php around line 215
Add:
    // check who has lent it before
    $SELECT = 'SELECT DISTINCT who FROM '.TBL_LENTED." WHERE diskid = '".addslashes($diskid)."'";
    $result = runSQL($SELECT);
    if (isset($result[0]['who'])) {
        $video['whohas'] = null;
        $_prefix = null;
        foreach ($result as $res) {
            $video['whohas'] .= $_prefix . $res['who'];
            $_prefix = ', ';
        }
    }
After:
    if (isset($result[0]['who']))
    {
        $video['who'] = $result[0]['who'];
    }

In file templates/elegant/show.tpl around line 112
Add:
          {if $video.whohas}
             <br/>
             {$lang.hasbeenlentto} {$video.whohas}
          {/if}
After:
          {if $video.who}
            <br/>
            {$lang.notavail} {$video.who}
          {/if}
Note:
Since I'm no big fan of smarty I'm not sure if this is correct. And if you're using another template you need to add it there too (i'm only using elegant).

In file language/en.php at the end:
Add:
$lang['hasbeenlentto'] = 'Has been lent before by:';

In file language/nl.php at the end:
Add:
$lang['hasbeenlentto'] = 'Uitgeleend geweest aan:';

Finally, you need to copy the structure of the lent table into a new one called lented.


This is a bit quick&dirty, but will do for now.
One problem i encountered with a quick test round is that you get
a database error when trying to return an item from somebody who
borrowed it before. Maybe I'll polish this a bit, if so, I'll post here again.
And yes, I'm dutch... "iznt dhat wiiierd?" :-)




Regards,
Sjon