Hello,
We found a need to clone a number of recipes in order to make, and keep, a variation (in this case we needed to keep a version of the recipe that had a differing yield to the original). Unfortunately, PHPRecipeBook had no "Copy" option under the Recipe, so this would have meant re-keying of the affected recipes.
As I had since spent the handful of hours required to derive the SQL statements to create these recipe copies manually, I wanted to codify the solution so that it could be run by any PRB user. Thus, attached is a patch that adds the missing "Copy" function to the Recipe View screen. I have extended the Recipe class to include a "duplicate" handler (as "clone" was reserved, as was "copy"). The duplicate routine will recurse, so that chained/child recipes will also be duplicated cleanly. The duplication mechanism is database driven, and thus runs very quickly, even in recursion (this has been tested on a MySQL install only).
Each recipe copy is named "<recipe name> - Copy". The ingredient relationships are ported, as are the recipe maps. As such, this routine will include pictures and comments in duplication, but not reviews, for example.
Submitted by ian.latter@midnightcode.org
recipe-copy.diff